需要。NET 3.5才能在VB.NET中使用
,但您不能将扩展类添加到现有命名空间,因此这似乎需要不同的方法。
我使用以下代码为我的2009-2012项目创建了一个新模块,并且在我的2013项目中不使用此模块。
- Imports Autodesk.AutoCAD.ApplicationServices
- Imports Autodesk.AutoCAD.Windows
- Imports System.Drawing
- Public Module DocumentExtension
- Function GetAcadDocument(ByRef doc As Document) As Object
- Return doc.AcadDocument
- End Function
- Function GetStatusBar(ByRef doc As Document) As Object
- Return doc.StatusBar
- End Function
- End Module
- Public Module WindowExtension
- Function GetSize(ByVal win As Window) As Size
- Return win.Size
- End Function
- Sub SetSize(ByVal win As Window, ByVal value As Size)
- win.Size = value
- End Sub
- Function GetIcon(ByVal win As Window) As Icon
- Return win.Icon
- End Function
- Sub SetIcon(ByVal win As Window, ByVal value As Icon)
- win.Icon = value
- End Sub
- Function GetLocation(ByVal win As Window) As Point
- Return win.Location
- End Function
- Sub SetLocation(ByVal win As Window, ByVal value As Point)
- win.Location = value
- End Sub
- End Module
|