System.Windows.Forms.TreeView

本文介绍了TreeView控件的使用方法,包括如何添加节点、显示图标、处理事件等特性。此外还提供了示例代码来展示如何创建复杂的TreeView结构。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

显示标题子项的一个层次化集合,并且每个子项都通过一个 TreeNode 而被呈现。

命名空间:System.Windows.Forms汇编集:System.Windows.Forms(在 system.windows.forms.dll 中)
语法
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class TreeView : Control
备注

Nodes 集合保持了所有被指派给 TreeView 控件的 TreeNode 对象。该集合中的这些树节点都能够被引用成根树节点。任何后续被添加到当前根树节点中的树节点都被引用成一个子节点。因为每个 TreeNode 都能够包含其他 TreeNode 对象的集合,在你反复通过这个集合进行查找的时候,你可能难以检测你在树结构中的位置。因此你可以使用 PathSeparator 对 TreeNode.Fullpath 字符串进行分析来检测是否是一个 TreeNode 标签的开始部分与结束部分。

你可以通过为 ImageList 属性指派一个 ImageList 并且引用 ImageList 来为某个 Image 所指定的索引值来显示树节点的图片。你可以使用下列属性来指派图片:

  • 把 ImageIndex 属性设置成你需要在树节点没有被选中的时候所显示的 Image 索引值。
  • 把 SelectedImageIndex 属性设置成你需要在树节点被选中的时候所显示的 Image 索引值。

通过 ImageIndex 与 SelectedImageIndex 属性值而被引用的图片是被指派到 Nodes 集合中的所有树节点在默认时被显示的图片。另外,个别树节点能够通过设置 TreeNode.ImageIndex 与 TreeNode.SelectedImageIndex 属性来重载默认的图片。

树节点能够被展开来显示下级子树节点。用户能够通过单击加号(+)按钮来展开 TreeNode,如果至少有一个子树节点被显示在当前 TreeNode 的下面,或者你也可以通过调用 TreeNode.Expand 方法来展开 TreeNode。如果要展开 Nodes 集合中的所有级别的子树节点,可以调用 ExpandAll 方法。你可以通过调用 TreeNode.Collapse 方法来收缩下级子 TreeNode,或者用户能够单击头号(-)按钮,如果至少有一个子树节点被显示在当前 TreeNode 的下面。你同样可以调用 TreeNode.Toggle 方法在展开与收缩状态之间进行切换。

树节点能够有选择性地显示复选框。要显示复选框,就需要把 TreeView 的 CheckBoxes 属性设置成 true。Checked 属性被设置成 true 的树节点会自动显示成一个被选中的状态。

注意:在 BeforeCheck 或者 AfterCheck 事件中设置 TreeNode.Checked 属性能够导致这些事件多次被触发并且还会导致出现不可预料的行为。例如,你可能在递归更新子节点的时候,在事件处理器中设置 Checked 属性,而事实上用户并没有展开并且单独地对每一个子节点进行复选。要防止多次被触发的事件,你可以在事件处理器中添加只执行你的递归代码的逻辑,如果 TreeViewEventArgs 的 Action 属性没有被设置成 TreeViewAction.Unknown,相关范例,请参考 AfterCheck 事件或者 BeforeCheck 事件的[范例]部分。

你可以通过设置一些显示属性与样式属性来改变 TreeView 控件的外观。把 ShowPlusMinus 设置成 true 会分别在每个能够被展开或者被收缩的 TreeNode 中显示一个加号按钮或者减号按钮。把 ShowRootLines 属性设置成 true 会导致 TreeView 显示所有根树节点之间的连接线。你可以把 ShowLines 属性设置成 true 来显示子树节点到它们的根节点之间的连接线。把 HotTracking 属性设置成 true 会在鼠标指针经过的时候改变树节点的标签外观。在热点被追踪到的时候,树节点的标签外观就会变成超级链接的形式。你同样可以完全定制 TreeView 控件的外观。要这样做,就需要把 DrawMode 属性设置成除了 TreeViewDrawMode.Normal 之外的任何值,并且处理 DrawNode 事件。

提示:在运行时设置 CheckBoxes、Scrollable、ImageIndex,以及 SelectedImageIndex 属性的时候,会重建(请参考:[Control.RecreateHandle])TreeView 的处理来更新控件的外观。这将导致所有的树节点都被收缩,但是除了被选中的 TreeNode 之外。

范例

下列代码范例示范了 TreeView 控件的使用。

// 以范例节点来组装 TreeView 控件。
private void InitializeTreeView()
{
    treeView1.BeginUpdate();
    treeView1.Nodes.Add("Parent");
    treeView1.Nodes[0].Nodes.Add("Child 1");
    treeView1.Nodes[0].Nodes.Add("Child 2");
    treeView1.Nodes[0].Nodes[1].Nodes.Add("Grandchild");
    treeView1.Nodes[0].Nodes[1].Nodes[0].Nodes.Add("Great Grandchild");
    treeView1.EndUpdate();
}

下面所示的更复杂的代码范例显示了 TreeView 控件中的自定义信息。根树节点显示了客户的名称,并且子树节点显示了被指派给每个客户的序列数字。在这个范例中,1,000 个客户平均按照每客户 15 个订单的规律而被显示。TreeView 的重绘通过使用 BeginUpdate 与 EndUpdate 方法而被抑制,并且在 TreeView 创建并且绘制 TreeNode 对象的时候还会显示一个表示等待的 Cursor。这个范例需要你拥有能够保持 Order 对象集合的 Customer 对象。另外同样需要你在 Form 中创建了 TreeView 控件实例的应用程序的目录中拥有一个名为 MyWait.cur 的鼠标指针文件。

// 创建新的 ArrayList 来保持 Customer 对象。
private ArrayList customerArray = new ArrayList(); 

private void FillMyTreeView()
{
   // 把客户添加到 Customer 对象的 ArrayList 中。
   for(int x=0; x<1000; x++)
   {
      customerArray.Add(new Customer("Customer" + x.ToString()));
   }

   // 在 Customer 对象的 ArrayList 中添加订单。
   foreach(Customer customer1 in customerArray)
   {
      for(int y=0; y<15; y++)
      {
         customer1.CustomerOrders.Add(new Order("Order" + y.ToString()));    
      }
   }

   // 在 TreeNode 被创建之前显示表示等待的鼠标指针。
   Cursor.Current = new Cursor("MyWait.cur");
        
   // 抑制 TreeView 的重绘直到所有的对象全部被创建完毕。
   treeView1.BeginUpdate();

   // 在每次调用这个方法的时候清除 TreeView 的内容。
   treeView1.Nodes.Clear();

   // 在每个 Customer 对象的 ArrayList 中添加一个根 TreeNode。
   foreach(Customer customer2 in customerArray)
   {
      treeView1.Nodes.Add(new TreeNode(customer2.CustomerName));
          
      // 在当前 Customer 的每个 Order 对象中添加子树节点。
      foreach(Order order1 in customer2.CustomerOrders)
      {
         treeView1.Nodes[customerArray.IndexOf(customer2)].Nodes.Add(
           new TreeNode(customer2.CustomerName + "." + order1.OrderID));
      }
   }

   // 把鼠标指针重围成所有控件的默认状态。
   Cursor.Current = Cursors.Default;

   // 开始重绘 TreeView。
   treeView1.EndUpdate();
}
继承层次
System.Object 
   System.MarshalByRefObject 
     System.ComponentModel.Component 
       System.Windows.Forms.Control 
        System.Windows.Forms.TreeView
           System.ComponentModel.Design.ObjectSelectorEditor.Selector
线程安全

这个类型的任何公开的静态(在 Visual Basic 中是 Shared)成员都是线程安全的。任何实例成员都不能够保证是线程安全的。

转载于:https://www.cnblogs.com/Laeb/archive/2007/02/11/647632.html

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _2 { public partial class 主界面 : Form { public 主界面() { InitializeComponent(); } private void InitializeComponent() { // 主容器和布局 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.treeViewNotes = new System.Windows.Forms.TreeView(); this.listViewNotes = new System.Windows.Forms.ListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.panel1 = new System.Windows.Forms.Panel(); this.lblLastModified = new System.Windows.Forms.Label(); this.lblNoteTitle = new System.Windows.Forms.Label(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.listViewVersions = new System.Windows.Forms.ListView(); this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.上传文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.打开ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.退出登录ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.注销账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.编辑ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.修改ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.修改密码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.删除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.笔记ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.上传文件ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.修改ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.删除ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.分类ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.版本历史ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.imageList1 = new System.Windows.Forms.ImageList(); // 设置控件属性 this.SuspendLayout(); // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 24); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 (左侧面板) // this.splitContainer1.Panel1.Controls.Add(this.treeViewNotes); this.splitContainer1.Panel1.Controls.Add(this.listViewNotes); // // splitContainer1.Panel2 (右侧面板) // this.splitContainer1.Panel2.Controls.Add(this.panel1); this.splitContainer1.Size = new System.Drawing.Size(1000, 576); this.splitContainer1.SplitterDistance = 300; this.splitContainer1.TabIndex = 0; // // treeViewNotes (笔记分类树) // this.treeViewNotes.Dock = System.Windows.Forms.DockStyle.Top; this.treeViewNotes.Location = new System.Drawing.Point(0, 0); this.treeViewNotes.Name = "treeViewNotes"; this.treeViewNotes.Size = new System.Drawing.Size(300, 300); this.treeViewNotes.TabIndex = 0; this.treeViewNotes.ImageList = imageList1; this.treeViewNotes.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewNotes_AfterSelect); this.treeViewNotes.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeViewNotes_NodeMouseDoubleClick); // 设置图像列表 imageList1.Images.Add(SystemIcons.Folder); // 文件夹图标用于分类 imageList1.Images.Add(SystemIcons.Document); // 文档图标用于笔记 // // listViewNotes (笔记列表) // this.listViewNotes.Dock = System.Windows.Forms.DockStyle.Fill; this.listViewNotes.View = System.Windows.Forms.View.Details; this.listViewNotes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, // 标题 this.columnHeader2, // 分类 this.columnHeader3, // 创建时间 this.columnHeader4 // 最后修改 }); this.listViewNotes.Location = new System.Drawing.Point(0, 300); this.listViewNotes.Name = "listViewNotes"; this.listViewNotes.Size = new System.Drawing.Size(300, 276); this.listViewNotes.TabIndex = 1; this.listViewNotes.UseCompatibleStateImageBehavior = false; this.listViewNotes.FullRowSelect = true; this.listViewNotes.MultiSelect = false; this.listViewNotes.SelectedIndexChanged += new System.EventHandler(this.listViewNotes_SelectedIndexChanged); // 设置列宽 this.columnHeader1.Text = "标题"; this.columnHeader1.Width = 120; this.columnHeader2.Text = "分类"; this.columnHeader2.Width = 80; this.columnHeader3.Text = "创建时间"; this.columnHeader3.Width = 120; this.columnHeader4.Text = "最后修改"; this.columnHeader4.Width = 120; // // panel1 (主内容面板) // this.panel1.Controls.Add(this.splitContainer2); this.panel1.Controls.Add(this.lblLastModified); this.panel1.Controls.Add(this.lblNoteTitle); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(696, 576); this.panel1.TabIndex = 0; // // lblNoteTitle (笔记标题标签) // this.lblNoteTitle.AutoSize = true; this.lblNoteTitle.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblNoteTitle.Location = new System.Drawing.Point(10, 10); this.lblNoteTitle.Name = "lblNoteTitle"; this.lblNoteTitle.Size = new System.Drawing.Size(100, 21); this.lblNoteTitle.TabIndex = 1; this.lblNoteTitle.Text = "未选择笔记"; // // lblLastModified (最后修改标签) // this.lblLastModified.AutoSize = true; this.lblLastModified.Location = new System.Drawing.Point(10, 40); this.lblLastModified.Name = "lblLastModified"; this.lblLastModified.Size = new System.Drawing.Size(0, 12); this.lblLastModified.TabIndex = 2; // // splitContainer2 (右侧分割容器) // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(0, 60); this.splitContainer2.Name = "splitContainer2"; this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer2.Panel1 (上部分 - 笔记内容) // this.splitContainer2.Panel1.Controls.Add(this.webBrowser1); // // splitContainer2.Panel2 (下部分 - 版本历史) // this.splitContainer2.Panel2.Controls.Add(this.listViewVersions); this.splitContainer2.Size = new System.Drawing.Size(696, 516); this.splitContainer2.SplitterDistance = 350; this.splitContainer2.TabIndex = 3; // // webBrowser1 (笔记内容浏览器) // this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill; this.webBrowser1.Location = new System.Drawing.Point(0, 0); this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); this.webBrowser1.Name = "webBrowser1"; this.webBrowser1.Size = new System.Drawing.Size(696, 350); this.webBrowser1.TabIndex = 0; // // listViewVersions (版本历史列表) // this.listViewVersions.Dock = System.Windows.Forms.DockStyle.Fill; this.listViewVersions.View = System.Windows.Forms.View.Details; this.listViewVersions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader5, // 版本 this.columnHeader6, // 创建时间 this.columnHeader7 // 描述 }); this.listViewVersions.Location = new System.Drawing.Point(0, 0); this.listViewVersions.Name = "listViewVersions"; this.listViewVersions.Size = new System.Drawing.Size(696, 162); this.listViewVersions.TabIndex = 0; this.listViewVersions.UseCompatibleStateImageBehavior = false; this.listViewVersions.FullRowSelect = true; this.listViewVersions.MultiSelect = false; this.listViewVersions.DoubleClick += new System.EventHandler(this.listViewVersions_DoubleClick); // 设置列宽 this.columnHeader5.Text = "版本"; this.columnHeader5.Width = 80; this.columnHeader6.Text = "创建时间"; this.columnHeader6.Width = 120; this.columnHeader7.Text = "描述"; this.columnHeader7.Width = 400; // // menuStrip1 (主菜单) // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.文件ToolStripMenuItem, this.编辑ToolStripMenuItem, this.笔记ToolStripMenuItem }); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1000, 25); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // // 文件ToolStripMenuItem (文件菜单) // this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.上传文件ToolStripMenuItem, this.打开ToolStripMenuItem1, this.退出登录ToolStripMenuItem, this.注销账号ToolStripMenuItem }); this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem"; this.文件ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); this.文件ToolStripMenuItem.Text = "文件"; // // 上传文件ToolStripMenuItem (上传文件菜单项) // this.上传文件ToolStripMenuItem.Name = "上传文件ToolStripMenuItem"; this.上传文件ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.上传文件ToolStripMenuItem.Text = "上传文件"; this.上传文件ToolStripMenuItem.Click += new System.EventHandler(this.上传文件ToolStripMenuItem_Click); // // 打开ToolStripMenuItem1 (打开文件菜单项) // this.打开ToolStripMenuItem1.Name = "打开ToolStripMenuItem1"; this.打开ToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.打开ToolStripMenuItem1.Text = "打开"; this.打开ToolStripMenuItem1.Click += new System.EventHandler(this.打开ToolStripMenuItem1_Click); // // 退出登录ToolStripMenuItem (退出登录菜单项) // this.退出登录ToolStripMenuItem.Name = "退出登录ToolStripMenuItem"; this.退出登录ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.退出登录ToolStripMenuItem.Text = "退出登录"; this.退出登录ToolStripMenuItem.Click += new System.EventHandler(this.退出登录ToolStripMenuItem_Click); // // 注销账号ToolStripMenuItem (注销账号菜单项) // this.注销账号ToolStripMenuItem.Name = "注销账号ToolStripMenuItem"; this.注销账号ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.注销账号ToolStripMenuItem.Text = "注销账号"; this.注销账号ToolStripMenuItem.Click += new System.EventHandler(this.注销账号ToolStripMenuItem_Click); // // 编辑ToolStripMenuItem (编辑菜单) // this.编辑ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.修改ToolStripMenuItem, this.修改密码ToolStripMenuItem, this.删除ToolStripMenuItem }); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); this.编辑ToolStripMenuItem.Text = "编辑"; // // 修改ToolStripMenuItem (修改菜单项) // this.修改ToolStripMenuItem.Name = "修改ToolStripMenuItem"; this.修改ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.修改ToolStripMenuItem.Text = "修改"; // // 修改密码ToolStripMenuItem (修改密码菜单项) // this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem"; this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.修改密码ToolStripMenuItem.Text = "修改密码"; this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click); // // 删除ToolStripMenuItem (删除菜单项) // this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem"; this.删除ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.删除ToolStripMenuItem.Text = "删除"; // // 笔记ToolStripMenuItem (笔记菜单) // this.笔记ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.上传文件ToolStripMenuItem1, this.修改ToolStripMenuItem1, this.删除ToolStripMenuItem1, this.分类ToolStripMenuItem, this.版本历史ToolStripMenuItem }); this.笔记ToolStripMenuItem.Name = "笔记ToolStripMenuItem"; this.笔记ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); this.笔记ToolStripMenuItem.Text = "笔记"; // // 上传文件ToolStripMenuItem1 (上传笔记菜单项) // this.上传文件ToolStripMenuItem1.Name = "上传文件ToolStripMenuItem1"; this.上传文件ToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.上传文件ToolStripMenuItem1.Text = "上传笔记"; this.上传文件ToolStripMenuItem1.Click += new System.EventHandler(this.上传文件ToolStripMenuItem_Click); // // 修改ToolStripMenuItem1 (修改笔记菜单项) // this.修改ToolStripMenuItem1.Name = "修改ToolStripMenuItem1"; this.修改ToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.修改ToolStripMenuItem1.Text = "修改"; this.修改ToolStripMenuItem1.Click += new System.EventHandler(this.修改ToolStripMenuItem_Click); // // 删除ToolStripMenuItem1 (删除笔记菜单项) // this.删除ToolStripMenuItem1.Name = "删除ToolStripMenuItem1"; this.删除ToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.删除ToolStripMenuItem1.Text = "删除"; this.删除ToolStripMenuItem1.Click += new System.EventHandler(this.删除ToolStripMenuItem1_Click); // // 分类ToolStripMenuItem (分类菜单项) // this.分类ToolStripMenuItem.Name = "分类ToolStripMenuItem"; this.分类ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.分类ToolStripMenuItem.Text = "分类"; this.分类ToolStripMenuItem.Click += new System.EventHandler(this.分类ToolStripMenuItem_Click); // // 版本历史ToolStripMenuItem (版本历史菜单项) // this.版本历史ToolStripMenuItem.Name = "版本历史ToolStripMenuItem"; this.版本历史ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.版本历史ToolStripMenuItem.Text = "版本历史"; this.版本历史ToolStripMenuItem.Click += new System.EventHandler(this.版本历史ToolStripMenuItem_Click); // 窗体设置 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1000, 600); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; this.Name = "Form2"; this.Text = "学习管理助手"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing); this.Load += new System.EventHandler(this.Form2_Load); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); private void 主界面_Load(object sender, EventArgs e) { } } } 为什么报错怎么改
最新发布
07-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值