也许是这样(A22009)
-
- Public Function ShowLineTypeDialog() As ObjectId
- Dim xLIneTypeDialog As New Autodesk.AutoCAD.Windows.LinetypeDialog()
- Dim dr As System.Windows.Forms.DialogResult
- dr = xLIneTypeDialog.ShowDialog()
- If dr = System.Windows.Forms.DialogResult.OK Then
- Dim SelLineType As ObjectId = xLIneTypeDialog.Linetype
- Return SelLineType
- ElseIf dr = System.Windows.Forms.DialogResult.Cancel Then
- Return ObjectId.Null
- End If
- End Function
- <CommandMethod("LTDia")> _
- Public Sub TestLinetypeDialog()
- Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
- Dim db As Database = doc.Database
- Try
- Using tr As Transaction = db.TransactionManager.StartTransaction
- Dim ltt As LinetypeTable = tr.GetObject(db.LinetypeTableId, OpenMode.ForRead)
- Dim ltID As ObjectId = ShowLineTypeDialog()
- Dim ltr As LinetypeTableRecord = TryCast(tr.GetObject(ltID, OpenMode.ForRead, False), LinetypeTableRecord)
- If ltr IsNot Nothing Then
- Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(ltr.Name + vbLf + ltr.AsciiDescription)
- End If
- End Using
- Catch ex As Autodesk.AutoCAD.Runtime.Exception
- doc.Editor.WriteMessage(ex.Message)
- End Try
- End Sub
~'J'~ |