Private Class JigFilter Implements System.Windows.Forms.IMessageFilter Private WM_LBUTTONDOWN = As Integer = &H201 Private WM_LBUTTONUP As Integer = &H202 Private WM_RBUTTONDOWN As Integer = &H204 Private WM_RBUTTONUP As Integer = &H205 Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean _ Implements System.Windows.Forms.IMessageFilter.PreFilterMessage If m.Msg = WM_RBUTTONDOWN Then 'Dim doc As Document = Application.DocumentManager.MdiActiveDocument() 'Dim ed As Editor = doc.Editor() 'ed.WriteMessage(vbCrLf + "Right Button pressed!!") If _toggleRotation = False Then _toggleRotation = True _posRotation = _position Else _angle = Entite.Rotation _toggleRotation = False End If Return True End If Return False End Function End Class
He all.
I use a code for catching the right click mousse.
It work fine in my computer but i have installed on other Pc and when right click occur autocad launch a other command... The command is random....
I dunno why ??
here the code New and the Run of my jig.
'************************************* '**** SUB NEW ************************ '************************************* Sub New(ByRef Doc As Document, ByRef tr As Transaction, ByRef db As Database, ByRef ent As Entity) MyBase.New(ent) Entite = Entity _filter = New JigFilter System.Windows.Forms.Application.AddMessageFilter(_filter) _Doc = Doc _db = db _tr = tr _angle = 0 _txtSize = 12
_alignH = TextHorizontalMode.TextCenter _alignV = TextVerticalMode.TextVerticalMid _toggleRotation = False _toggleBold = False _toggleItalic = False Update() End Sub
'************************************* '**** FONCTION RUN ******************* '************************************* Public Function Run() As PromptStatus Dim stat As PromptStatus = PromptStatus.Keyword 'While (stat = PromptStatus.Keyword) Do While (stat = PromptStatus.Keyword) Dim promptResult As PromptResult = _ _Doc.Editor.Drag(Me)
stat = promptResult.Status Loop 'Raz eventHandler System.Windows.Forms.Application.RemoveMessageFilter(_filter) _filter = Nothing Return stat End Function
It might be easier to create a new Editor.PointMonitor
Editor ed =
Application.DocumentManager.MdiActiveDocument.Editor;
ed.PointMonitor +=
newPointMonitorEventHandler(ed_PointMonitor);
and watch for the right click via the History property...?
thank. I dont know how to use event handler.
I must learn this..
i changed the mouse click with key - and + and using this :