0

我需要在左侧创建工具条。但工具箱没有任何 ToolStripContainer。

在此处输入图像描述

因此,我尝试通过在设计文件中编码来手动添加 ToolStripContainer。但是 ToolStripContainer 是由红十字绘制的。

 Private Sub InitializeComponent()
      Me.toolStripContainer1 = New System.Windows.Forms.ToolStripContainer()
      Me.SuspendLayout()
      Me.toolStripContainer1.Size = New System.Drawing.Size(635, 407)
      Me.toolStripContainer1.TabIndex = 0
      Me.toolStripContainer1.Text = "ToolStripContainer1"

      Me.Controls.Add(Me.toolStripContainer1)
      Me.toolStripContainer1.LeftToolStripPanel.ResumeLayout(False)
      Me.toolStripContainer1.LeftToolStripPanel.PerformLayout()
      Me.ResumeLayout(False)
      Me.PerformLayout()
 End Sub 

我可以在 .Net 5.0 中使用 ToolStripContainer

4

1 回答 1

0

微软似乎提倡继续使用 .net 框架中的 winforms 设计器 - 本质上,您应该有两个项目,一个用于进行表单设计的 .NET 框架,一个用于“添加现有项目”的 .NET core/5表格以便它们编译和工作(但您在另一个项目中设计它们/打开两个 VS)

有关更多信息,请参阅https://github.com/dotnet/winforms/blob/main/docs/winforms-designer.md

于 2021-04-26T09:02:13.260 回答