使用net可以创建一个类似属性面板的自定义的任务窗格,从而实现应用程序更丰富的人机交互。
1、添加一个自定义控件
2、在前面创建的代码框架内增加一个命令函数ShowMyPalette
Imports System.Windows.Media.Imaging
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Windows
Imports Autodesk.Windows
Public Class WellcomCAD
<CommandMethod("ShowMyPalette")>
Public Sub ShowMyPalette()
Dim ps As PaletteSet
If ps Is Nothing Then
ps = New PaletteSet("我的工具箱")
ps.MinimumSize = New System.Drawing.Size(150, 240)
ps.Add("Test", New MyControl)
End If
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
ps.Visible = True
ps.Dock = DockSides.Left
End Sub
End Class
框架有了剩下的就是在此基础上完善控件截面和编写对应代码的工作了!