public static void DoIt() { if (ps==null) { //use constructor with Guid so that we can save/load user data ps = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set",new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6")); ps.Load+=new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load); ps.Save+=new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save); ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; ps.MinimumSize = new System.Drawing.Size(300,300); ps.Add("Test Palette 1", new TestControl()); } bool b = ps.Visible; ps.Visible = true; Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor; Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:","Opacity","TitleBarLocation","Docking"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { switch (res.StringResult) { case "Opacity": Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt; do { resInt = e.GetInteger("Enter opacity:"); if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK) break; if (resInt.Value>=0 && resInt.Value<=100) break; e.WriteMessage("Opacity must be between 0 and 100\n"); } while (true); ps.Opacity = resInt.Value; break; case "TitleBarLocation": res = e.GetKeywords("Select titlebar location:","Left","Right"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) switch (res.StringResult) { case "Left": ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Left; break; case "Right": ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Right; break; } break; case "Docking": { res = e.GetKeywords("Choose a docking option:","None","Left","Right","Top","Bottom"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { switch (res.StringResult) { case "None": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None; break; case "Left": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left; break; case "Right": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right; break; case "Top": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Top; break; case "Bottom": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Bottom; break; } } break; } } } }
public void QuickPlot() { if (m_ps == null) { //use constructor with Guid so that we can save/load user data m_ps = new Autodesk.AutoCAD.Windows.PaletteSet("", new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6")); m_ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; m_ps.MinimumSize = new System.Drawing.Size(340, 200); m_ps.Add("", new PaletteControl()); m_ps.Visible = true; } else { if (m_ps.Visible) { m_ps.Visible = false; } else { m_ps.Visible = true; } } }
private ACADProcessObjectHandler() { ps = new Autodesk.AutoCAD.Windows.PaletteSet("Технология", new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6")); ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; ps.MinimumSize = new System.Drawing.Size(300, 200); fmObject = new ObjectForm(this); ps.Add("Объекты", fmObject); fmSetting = new SettingForm(this); ps.Add("Настройка", fmSetting); ObjectParams param = new ObjectParams(); param.MaterialType = 0; param.GreatSpeed = 1500; param.SmallSpeed = 250; param.Frequency = 1800; param.DepthAll = 32; param.Depth = 32; param.ToolNo = 1; param.Tools = new ObjectParams.Tool[3]; param.Tools[0].Diameter = 100; param.Tools[0].Thickness = 1; param.Tools[1].Diameter = 200; param.Tools[1].Thickness = 2; param.Tools[2].Diameter = 300; param.Tools[2].Thickness = 3; fmSetting.Params = param; ed.SelectionAdded += new SelectionAddedEventHandler(callback_SelectionAdded); fmObject.SelectItemAction = delegate(int index) { return(m_processList[index].SetSelected()); }; }
public void WireUp() { Palette = new Autodesk.AutoCAD.Windows.PaletteSet(AppConstants.APP_NAME, Commands.Commands.PALETTESET_COMMAND, new Guid(AppConstants.APP_ID)) { MinimumSize = new System.Drawing.Size(800, 600), }; Palette.AddVisual("Main", new Main_View(), true); }
public static void LaunchDock() { if (DockPalette == null) { DockPalette = new Autodesk.AutoCAD.Windows.PaletteSet("AcadIO Dock"); DockPalette.AddVisual("AcadIODock", DockRef); } DockPalette.MinimumSize = new Size(580, 440); //undocked size DockPalette.Visible = true; DockPalette.Dock = Autodesk.AutoCAD.Windows.DockSides.None; DockPalette.DockEnabled = Autodesk.AutoCAD.Windows.DockSides.None; DockPalette.Location = new Point(100, 100); //manually refresh the window to make it appear undocked - acad quirk DockPalette.Visible = false; DockPalette.Visible = true; AcadIO.IOEvents.LoadCurrentDrawing(); World.AcadIoDockVisible = true; // //everything below here is for the sake of the demo // DockRef.Instructions.Text = "Use Insert to insert a new block." + System.Environment.NewLine + "Select the block so the object selected event fires, or use Select Object to manually select the block." + System.Environment.NewLine + "Retrieve the value (record/property/attribute) associated with the key" + System.Environment.NewLine + "Rectangle block has " + System.Environment.NewLine + "properties: length, width, flip" + System.Environment.NewLine + "records: name" + System.Environment.NewLine + "attribute: displayname" + System.Environment.NewLine + "flip property must be set as 0 or 1"; DockRef.BlockPath.Text = World.InstallPath + "\\_DemoObjects"; DockRef.BlockName.Text = "demoRectangle"; DockRef.BlockRecordKey.Text = "name"; DockRef.BlockRecordValue.Text = ""; DockRef.BlockPropertyKey.ItemsSource = new List <string> { "length", "width" }; DockRef.BlockPropertyValue.Text = ""; DockRef.BlockFlipPropertyKey.Text = "flip"; DockRef.BlockFlipPropertyKey.IsEnabled = false; DockRef.BlockFlipPropertyValue.Text = ""; DockRef.BlockAttributeKey.Text = "displayname"; DockRef.BlockAttributeKey.IsEnabled = false; DockRef.BlockAttributeValue.Text = ""; DockRef.NODRecordKey.Text = "acadio"; DockRef.NODRecordValue.Text = ""; }
public void cmdShowPalette() { if (s_ps == null) { s_ps = new Autodesk.AutoCAD.Windows.PaletteSet("Demo", new Guid()); s_ps.DockEnabled = Autodesk.AutoCAD.Windows.DockSides.Left; s_ps.Add("DemoTab", new PaletteUserControl() { Dock = System.Windows.Forms.DockStyle.Fill }); } s_ps.Visible = true; }
public static void DoIt() { if (ps == null) { //use constructor with Guid so that we can save/load user data ps = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("{00C0E891-C266-43e4-B95C-613255855BE1}")); ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load); ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save); ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; ps.MinimumSize = new System.Drawing.Size(350, 300); ps.Add("XData Palette", new xdataForm(null)); } bool b = ps.Visible; ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None; ps.Visible = true; ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left; Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor; //下面的主要是设置palette的一些相关属性的 //在后面的开发中可以做一些相应的简化 //例如,直接设置一些值 //Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking"); //if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) //{ // switch (res.StringResult) // { // case "Opacity": // SetOpacity(); // break; // case "TitleBarLocation": // SetTitleBarLocation(); // break; // case "Docking": // SetDocking(); // break; // } //} }
public static void DoIt() { if (ps == null) { //use constructor with Guid so that we can save/load user data ps = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("{00C0E891-C266-43e4-B95C-613255855BE1}")); ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load); ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save); ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; ps.MinimumSize = new System.Drawing.Size(350, 300); ps.Add("XData Palette", new xdataForm(null)); } bool b = ps.Visible; ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None; ps.Visible = true; ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left; Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor; //下面的主要是设置palette的一些相关属性的 //在后面的开发中可以做一些相应的简化 //例如,直接设置一些值 //Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking"); //if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) //{ // switch (res.StringResult) // { // case "Opacity": // SetOpacity(); // break; // case "TitleBarLocation": // SetTitleBarLocation(); // break; // case "Docking": // SetDocking(); // break; // } //} }
public void BindPaletteSet(Autodesk.AutoCAD.Windows.PaletteSet ps) { ps.Add("属性控件", this); this.PaletteSet = ps; }
public static void DoIt() { if (ps == null) { //use constructor with Guid so that we can save/load user data ps = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6")); ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load); ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save); ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton | Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton; ps.MinimumSize = new System.Drawing.Size(300, 300); ps.Add("Test Palette 1", new TestControl()); } bool b = ps.Visible; ps.Visible = true; Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor; Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { switch (res.StringResult) { case "Opacity": Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt; do { resInt = e.GetInteger("Enter opacity:"); if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { break; } if (resInt.Value >= 0 && resInt.Value <= 100) { break; } e.WriteMessage("Opacity must be between 0 and 100\n"); }while (true); ps.Opacity = resInt.Value; break; case "TitleBarLocation": res = e.GetKeywords("Select titlebar location:", "Left", "Right"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { switch (res.StringResult) { case "Left": ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Left; break; case "Right": ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Right; break; } } break; case "Docking": { res = e.GetKeywords("Choose a docking option:", "None", "Left", "Right", "Top", "Bottom"); if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK) { switch (res.StringResult) { case "None": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None; break; case "Left": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left; break; case "Right": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right; break; case "Top": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Top; break; case "Bottom": ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Bottom; break; } } break; } } } }
//设置可见性 public void BindPaletteSet(Autodesk.AutoCAD.Windows.PaletteSet ps) { ps.Add("场景管理", this); this.PaletteSet = ps; this.PaletteSet.KeepFocus = true; }
public void MyCommand() { if (_ps != null) { _ps.Visible = true; } else { _ps = new Autodesk.AutoCAD.Windows.PaletteSet("UCS Road Centerline Tool"); _ps.Size = new Size(600, Math.Max(350, _ps.Size.Height)); _ps.Visible = true; _ps.DockEnabled = (Autodesk.AutoCAD.Windows.DockSides) ((int)Autodesk.AutoCAD.Windows.DockSides.Left + (int)Autodesk.AutoCAD.Windows.DockSides.Right); _ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left; _ps.KeepFocus = false; Help helpUC = new UCS_Road_Lines.Help(); ElementHost helpEH = new ElementHost(); helpEH.AutoSize = true; helpEH.Dock = DockStyle.Fill; helpEH.Child = helpUC; helpEH.Name = "How to"; _ps.Add("How to...", helpEH); OneLaneRoadUserControl oneLane = new OneLaneRoadUserControl(); ElementHost singleLanes = new ElementHost(); singleLanes.AutoSize = true; singleLanes.Dock = DockStyle.Fill; singleLanes.Child = oneLane; singleLanes.Name = "EH_1L"; _ps.Add("One Lane Roads", singleLanes); TwoLaneRoadsUserControl twoLane = new TwoLaneRoadsUserControl(); ElementHost twoLanes = new ElementHost(); twoLanes.AutoSize = true; twoLanes.Dock = DockStyle.Fill; twoLanes.Child = twoLane; twoLanes.Name = "EH_2L"; _ps.Add("Two Lane Roads", twoLanes); ThreeLaneRoads threeLane = new UCS_Road_Lines.ThreeLaneRoads(); ElementHost threeLanes = new ElementHost(); threeLanes.AutoSize = true; threeLanes.Dock = DockStyle.Fill; threeLanes.Child = threeLane; threeLane.Name = "EH_3L"; _ps.Add("Three Lane Roads", threeLanes); FourLaneRoads fourLane = new UCS_Road_Lines.FourLaneRoads(); ElementHost fourLanesEH = new ElementHost(); fourLanesEH.AutoSize = true; fourLanesEH.Dock = DockStyle.Fill; fourLanesEH.Child = fourLane; fourLane.Name = "EH_4L"; _ps.Add("Four Lane Roads", fourLanesEH); FiveLaneRoads fiveLane = new UCS_Road_Lines.FiveLaneRoads(); ElementHost fiveLaneEH = new ElementHost(); fiveLaneEH.AutoSize = true; fiveLaneEH.Dock = DockStyle.Fill; fiveLaneEH.Child = fiveLane; fiveLane.Name = "EH_5L"; _ps.Add("Five Lane Roads", fiveLaneEH); SixLaneRoads sixLane = new UCS_Road_Lines.SixLaneRoads(); ElementHost sixLaneEH = new ElementHost(); sixLaneEH.AutoSize = true; sixLaneEH.Dock = DockStyle.Fill; sixLaneEH.Child = sixLane; sixLane.Name = "EH_6L"; _ps.Add("Six Lane Roads", sixLaneEH); } }
/// <summary> /// 显示面板 /// </summary> /// <param name="PaletteSet">要显示的面板</param> /// <param name="side">停靠位置</param> static public void ShowPaletteSet(Autodesk.AutoCAD.Windows.PaletteSet PaletteSet, Autodesk.AutoCAD.Windows.DockSides side) { PaletteSet.Visible = true; PaletteSet.Dock = side; PaletteSet.KeepFocus = true; }