欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOCX文档下载  

    SystemWindowsForms层次结构.docx

    • 资源ID:3166459       资源大小:41KB        全文页数:13页
    • 资源格式: DOCX        下载积分:6.99金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要6.99金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    SystemWindowsForms层次结构.docx

    SystemWindowsForms层次结构System.Windows.Forms的层次结构,在树图中显示 在Visual Studio 中新建Winform应用程序YlqForm,新建一个windows窗体 GetClassForm,窗体GetClassForm中加入TreeView:tvList,RichTextBox: richTextBox1, Button:btnFind,以及两个Label 如下图所示: 程序源代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace YlqForm public partial class GetClassForm : Form DataTable dtClass = new DataTable; public GetClassForm InitializeComponent; / <summary> / 获得System.Windows.Forms类的层次表 / 返回数据表的列名有:ClassName,BaseClassName,Remark / </summary> / <returns></returns> private DataTable GetDataTable DataTable dt = new DataTable; /* * 列ClassName -类名如Label * 列BaseClassName -基类名如Control。联合为一起即Label : Control * 列Remark -类(如:Label)的详细说明 */ dt.Columns.Add("ClassName", typeof(string); dt.Columns.Add("BaseClassName", typeof(string); dt.Columns.Add("Remark", typeof(string); /* * 数据详细行 * 依次输入ClassName、BaseClassName、Remark * 如"Label","Control","表示标准Windows 标签。" */ #region 层次结构的根 dt.Rows.Add("System.MarshalByRefObject", "System.Object", "允许在支持远程处理的应用程序中跨应用程序域边界访问对象。"); dt.Rows.Add("Component", "System.MarshalByRefObject", "提供System.ComponentModel.IComponent 接口的基实现并启用应用程序之间的对象共享。"); #endregion #region 基本System.Windows.Forms控件类 dt.Rows.Add("Button", "ButtonBase", "表示Windows 按钮控件。"); dt.Rows.Add("CheckBox", "ButtonBase", "表示Windows System.Windows.Forms.CheckBox"); dt.Rows.Add("CheckedListBox", "ListBox", "显示一个System.Windows.Forms.ListBox,其中在每项的左边显示一个复选框。"); dt.Rows.Add("ColorDialog", "CommonDialog", "表示一个通用对话框,该对话框显示可用的颜色以及允许用户定义自定义颜色的控件。"); dt.Rows.Add("ComboBox", "ListControl", "表示Windows 组合框控件。"); dt.Rows.Add("ContextMenuStrip", "ToolStripDropDownMenu", "表示快捷菜单。"); dt.Rows.Add("DataGridView", "Control", "在可自定义的网格中显示数据。"); dt.Rows.Add("DateTimePicker", "Control", "表示一个Windows 控件,该控件用来让用户选择日期和时间并以指定的格式显示此日期和时间。"); dt.Rows.Add("DomainUpDown", "UpDownBase", "表示显示字符串值的Windows 数字显示框。"); dt.Rows.Add("ErrorProvider", "Component", "提供用于指示窗体上的控件具有关联错误的用户界面。"); dt.Rows.Add("EventLog", "Component", "提供与Windows 事件日志的交互。"); /System.Diagnostics.EventLog dt.Rows.Add("FlowLayoutPanel", "Panel", "表示一个沿着水平或垂直方向动态排放其内容的面板。"); dt.Rows.Add("FolderBrowserDialog", "CommonDialog", "提示用户选择文件夹。无法继承此类。"); dt.Rows.Add("FontDialog", "CommonDialog", "提示用户从本地计算机上安装的字体中选择一种字体。"); dt.Rows.Add("GroupBox", "Control", "表示一个Windows 控件,该控件显示围绕一组具有可选标题的控件的框架。"); dt.Rows.Add("HelpProvider", "Component", "提供控件的弹出或联机帮助。"); dt.Rows.Add("HScrollBar", "ScrollBar", "表示一个标准Windows 水平滚动条。"); dt.Rows.Add("ImageList", "Component", "提供管理System.Drawing.Image 对象集合的方法。无法继承此类。"); dt.Rows.Add("Label", "Control", "表示标准Windows 标签。"); dt.Rows.Add("LinkLabel", "Label", "表示可显示超链接的Windows 标签控件。"); dt.Rows.Add("ListBox", "ListControl", "表示用于显示项列表的Windows 控件。"); dt.Rows.Add("ListView", "Control", "表示Windows 列表视图控件,该控件显示可用四种不同视图之一显示的项集合。"); dt.Rows.Add("MaskedTextBox", "TextBoxBase", "使用掩码区分正确和不正确的用户输入。"); dt.Rows.Add("MenuStrip", "ToolStrip", "提供窗体的菜单系统。"); dt.Rows.Add("MonthCalendar", "Control", "表示一个Windows 控件,该控件使用户能够使用可视月历显示来选择日期。"); dt.Rows.Add("NotifyIcon", "NotifyIcon", "指定在通知区域中创建图标的组件。无法继承此类。"); dt.Rows.Add("NumericUpDown", "UpDownBase", "表示显示数值的Windows 数字显示框。"); dt.Rows.Add("OpenFileDialog", "FileDialog", "提示用户打开文件。无法继承此类。"); dt.Rows.Add("PageSetupDialog", "CommonDialog", "允许用户更改与页面相关的打印设置,包括边距和纸张方向。无法继承此类。"); dt.Rows.Add("Panel", "ScrollableControl", "用于对控件集合进行分组。"); dt.Rows.Add("PerformanceCounter", "Component", "表示Windows NT 性能计数器组件。");/System.Diagnostics.PerformanceCounter dt.Rows.Add("PictureBox", "Control", "表示用于显示图像的Windows 图片框控件。"); dt.Rows.Add("PrintDialog", "CommonDialog", "允许用户从Windows 窗体应用程序中选择一台打印机,并选择文档中要打印的部分。"); dt.Rows.Add("PrintPreviewControl", "Control", "表示Windows 窗体应用程序打印预览的原始预览部分,没有任何对话框或按钮。"); dt.Rows.Add("Process", "Component", "提供对本地和远程进程的访问并使您能够启动和停止本地系统进程。");/System.Diagnostics.Process dt.Rows.Add("ProgressBar", "Control", "表示Windows 进度栏控件。"); dt.Rows.Add("PropertyGrid", "ContainerControl", "提供用于浏览对象属性的用户界面。"); dt.Rows.Add("RadioButton", "ButtonBase", "当与其他System.Windows.Forms.RadioButton 控件成对出现时,使用户能够从一组选项中选择一个选项。"); dt.Rows.Add("RichTextBox", "TextBoxBase", "表示Windows 多格式文本框控件。"); dt.Rows.Add("SaveFileDialog", "FileDialog", "提示用户选择文件的保存位置。无法继承此类。"); dt.Rows.Add("SerialPort", "Component", "表示串行端口资源。");/System.IO.Ports.SerialPort dt.Rows.Add("ServiceController", "Component", "表示Windows 服务并允许连接到正在运行或者已停止的服务、对其进行操作或获取有关它的信息。"); /System.ServiceProcess.ServiceController; /需要添加引用 dt.Rows.Add("SplitContainer", "ContainerControl", "表示一个由可移动条组成的控件,该可移动条将容器的显示区域分成两个大小可调的面板。"); dt.Rows.Add("StatusStrip", "ToolStrip", "表示Windows 状态栏控件。"); dt.Rows.Add("TabControl", "Control", "管理相关的选项卡页集。"); dt.Rows.Add("TableLayoutPanel", "Panel", "表示一个面板,它可以在一个由行和列组成的网格中对其内容进行动态布局。"); dt.Rows.Add("TextBox", "TextBoxBase", "表示Windows 文本框控件。"); dt.Rows.Add("Timer", "Component", "实现按用户定义的时间间隔引发事件的计时器。此计时器最宜用于Windows 窗体应用程序中,并且必须在窗口中使用。");/System.Windows.Forms.Timer dt.Rows.Add("ToolStrip", "ScrollableControl", "为Windows 工具栏对象提供容器。"); dt.Rows.Add("ToolStripContainer", "ContainerControl", "在窗体的每一侧提供面板,并提供可以容纳一个或多个控件的中间面板。"); dt.Rows.Add("TrackBar", "Control", "表示一个标准的Windows 跟踪条。"); dt.Rows.Add("TreeView", "Control", "显示标记项的分层集合,每个标记项用一个System.Windows.Forms.TreeNode 来表示。"); dt.Rows.Add("VScrollBar", "ScrollBar", "表示标准的Windows 垂直滚动条。"); dt.Rows.Add("WebBrowser", "WebBrowserBase", "使用户可以在窗体中导航网页。"); dt.Rows.Add("ReportViewer", "UserControl", "封装用于ReportViewer 控件的方法和属性。");/Microsoft.Reporting.WinForms.ReportViewer dt.Rows.Add("Form", "ContainerControl", "表示组成应用程序的用户界面的窗口或对话框。"); #endregion #region System.Windows.Forms控件类的基类 dt.Rows.Add("ButtonBase", "Control", "实现按钮控件共同的基本功能。"); dt.Rows.Add("ListControl", "Control", "为System.Windows.Forms.ListBox 类和System.Windows.Forms.ComboBox 类提供一个共同的成员实现方法。"); dt.Rows.Add("CommonDialog", "Component", "指定用于在屏幕上显示对话框的基类。"); dt.Rows.Add("Control", "Component", "定义控件的基类,控件是带有可视化表示形式的组件。实现了定义鼠标事件IDropTarget。"); dt.Rows.Add("UpDownBase", "ContainerControl", "实现数字显示框所需的基本功能。"); dt.Rows.Add("ScrollBar", "Control", "实现滚动条控件的基本功能。"); dt.Rows.Add("TextBoxBase", "Control", "实现文本控件要求的基本功能。"); dt.Rows.Add("FileDialog", "CommonDialog", "显示一个用户可从中选择文件的对话框窗口。"); dt.Rows.Add("ContainerControl", "ScrollableControl", "为可用作其他控件的容器的控件提供焦点管理功能。"); dt.Rows.Add("ScrollableControl", "Control", "为支持自动滚动行为的控件定义一个基类。"); dt.Rows.Add("WebBrowserBase", "Control", "为泛型ActiveX 控件提供包装以便由System.Windows.Forms.WebBrowser 控件用作基类。"); dt.Rows.Add("UserControl", "ContainerControl", "提供一个可用来创建其他控件的空控件。"); dt.Rows.Add("ToolStripDropDownMenu", "ToolStripDropDown", "提供System.Windows.Forms.ContextMenuStrip 控件的基本功能。"); dt.Rows.Add("ToolStripDropDown", "ToolStrip", "表示当用户单击System.Windows.Forms.ToolStripDropDownButton 时,使用户可以从列表中选择单个项的控件。"); #endregion return dt; / <summary> / 查看按钮的点击事件 / </summary> private void btnFind_Click(object sender, EventArgs e) /System.Object为根节点 tvList.Nodes.Clear; TreeNode rootNode = tvList.Nodes.Add("System.Object"); rootNode.Tag = "支持.NET Framework 类层次结构中的所有类,并为派生类提供低级别服务。这是.NET Framework 中所有类的最终基类;它是类型层次结构的根。" DataTable dt = GetNewDataTable(dtClass, string.Format("BaseClassName='0'", "System.Object"); BindTreeView(dt, rootNode.Nodes); tvList.ExpandAll; / <summary> / 绑定TreeView / </summary> / <param name="dt">满足父节点的表</param> / <param name="nodes">节点的集合</param> public void BindTreeView(DataTable dt, TreeNodeCollection nodes) for (int i = 0; i < dt.Rows.Count; i+) TreeNode tempNode = new TreeNode; tempNode.Text = dt.Rowsi"ClassName".ToString; tempNode.Tag = dt.Rowsi"Remark".ToString; nodes.Add(tempNode); /以当前节点的ClassName作为基类,查看该节点下的子类 DataTable subDataTable = GetNewDataTable(dtClass, string.Format("BaseClassName='0'", dt.Rowsi"ClassName".ToString); if (subDataTable.Rows.Count > 0) BindTreeView(subDataTable, tempNode.Nodes); / <summary> / 执行DataTable中的查询返回新的DataTable / </summary> / <param name="dt">源数据DataTable</param> / <param name="condition">查询条件如id='a5'</param> / <returns></returns> public static DataTable GetNewDataTable(DataTable dt, string condition) DataTable newdt = new DataTable; newdt = dt.Clone; DataRow dr = dt.Select(condition); for (int i = 0; i < dr.Length; i+) newdt.ImportRow(dri); return newdt;/返回的查询结果 / <summary> / 窗体GetClassForm的Load事件 / </summary> private void GetClassForm_Load(object sender, EventArgs e) dtClass = GetDataTable; / <summary> / 在选定树节点后发生。 / </summary> private void tvList_AfterSelect(object sender, TreeViewEventArgs e) if (tvList.SelectedNode = null) richTextBox1.Text = "" return; TreeNode node = tvList.SelectedNode; /子节点集合 StringBuilder sb = new StringBuilder; for (int i = 0; i < node.Nodes.Count; i+) sb.AppendFormat("0:1n", node.Nodesi.Text, Convert.ToString(node.Nodesi.Tag); richTextBox1.Text = string.Format("当前类:0n说明:1nn继承的父类:n2:3nn子类列表:n4", node.Text, Convert.ToString(node.Tag), node.Parent = null ? "" : node.Parent.Text, node.Parent = null ? "" : Convert.ToString(node.Parent.Tag), sb.ToString); 程序运行后,点击“查看” 按钮结果截图: 选中TreeView的一个节点,提示框将提示相应的信息:

    注意事项

    本文(SystemWindowsForms层次结构.docx)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开