新建一个停靠窗口PaletteSet的Dock属性时,使用以下代码发现不生效:
var ps = new Autodesk.AutoCAD.Windows.PaletteSet("test");
ps.Size = new System.Drawing.Size(150, 300);
ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
System.Windows.Forms.UserControl myCtrl = new SidebarForm();
ps.Add("subtest", myCtrl);
ps.Visible = true;
经过搜索得知,设置Dock属性前,必须设置Visible属性为true,否则Dock属性不生效,正确代码如下:
var ps = new Autodesk.AutoCAD.Windows.PaletteSet("test");
ps.Size = new System.Drawing.Size(150, 300);
ps.Visible = true;
ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
System.Windows.Forms.UserControl myCtrl = new SidebarForm();
ps.Add("subtest", myCtrl);
原文链接:https://blog.csdn.net/andr0id/article/details/121746791