Imports ZwSoft.ZwCAD.Runtime
Imports ZwSoft.ZwCAD.Windows
Imports ZwSoft.ZwCAD.ApplicationServices
Public Class ZwApps
<CommandMethod("CreateMenu")> _
Public Sub CreateMenu()
Dim Cmenu As New ContextMenuExtension()
Cmenu.Title = "Context Menu"
Dim Item1 As New MenuItem("Line")
AddHandler Item1.Click, AddressOf mi1_Click
Dim Item2 As New MenuItem("Circle")
AddHandler Item2.Click, AddressOf mi2_Click
Cmenu.MenuItems.Add(Item1)
Cmenu.MenuItems.Add(Item2)
Application.AddDefaultContextMenuExtension(Cmenu)
End Sub
Private Sub mi1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
ZwDoc.SendStringToExecute("Line " & vbLf, True, False, True)
End Sub
Private Sub mi2_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
ZwDoc.SendStringToExecute("Circle " & vbLf, True, False, True)
End Sub
Imports ZwSoft.ZwCAD.Windows
Imports ZwSoft.ZwCAD.ApplicationServices
Public Class ZwApps
<CommandMethod("CreateMenu")> _
Public Sub CreateMenu()
Dim Cmenu As New ContextMenuExtension()
Cmenu.Title = "Context Menu"
Dim Item1 As New MenuItem("Line")
AddHandler Item1.Click, AddressOf mi1_Click
Dim Item2 As New MenuItem("Circle")
AddHandler Item2.Click, AddressOf mi2_Click
Cmenu.MenuItems.Add(Item1)
Cmenu.MenuItems.Add(Item2)
Application.AddDefaultContextMenuExtension(Cmenu)
End Sub
Private Sub mi1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
ZwDoc.SendStringToExecute("Line " & vbLf, True, False, True)
End Sub
Private Sub mi2_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
ZwDoc.SendStringToExecute("Circle " & vbLf, True, False, True)
End Sub
End Class