谢谢版主,我更新了图片,帮忙看看,那怎么回事!!
另外
那个我有Dispose也不行,程序我10的,不好调试,我加msgbox观察,根本没有运行过SetSystemVariable那一句,就是在那一句出现的InvalidInput的。
这就是我的一个函数,不管是在Jig的New中调用,还是在Btn按钮的Click事件中调用,都提示InvalidInput
Friend Shared Function GetArrowObjectID(ByVal sets As CSetting) As ObjectId
Dim BlkName As String = ""
Dim Dbase As Database = Application.DocumentManager.MdiActiveDocument.Database
Select Case sets.ArrowName
Case 1
BlkName = sets.BlockName
Case 3
BlkName = "_ClosedBlank"
Case 4
BlkName = "_Dot"
Case 5
BlkName = "_DotSmall"
Case 6
BlkName = "_DotBlank"
Case 7
BlkName = "_Small"
Case 8
BlkName = "_BoxBlank"
Case 9
BlkName = "_BoxFilled"
Case 10
BlkName = "_Open"
Case 11
BlkName = "_Open30"
Case 12
BlkName = "_Open90"
End Select
Dim OldName As String
If sets.ArrowName 1 Then
OldName = Application.GetSystemVariable("DIMLDRBLK")
Application.SetSystemVariable("DIMLDRBLK", BlkName)
If OldName.Length 0 Then Application.SetSystemVariable("DIMLDRBLK", OldName)
End If
Dim Trans As Transaction = Dbase.TransactionManager.StartTransaction
Dim BlkTable As BlockTable = Trans.GetObject(Dbase.BlockTableId, OpenMode.ForRead)
GetArrowObjectID = BlkTable.Item(BlkName)
Trans.Commit()
Trans.Dispose()
End Function
但是我就测试下面这一小段代码,是没有问题的
_
Public Sub test()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim res As PromptResult = ed.GetString("input arrow:")
If res.Status = PromptStatus.OK Then
Application.SetSystemVariable("DIMLDRBLK", res.StringResult)
End If
End Sub