.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What event I should use to read left click mouse location all the time?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
JanetDavidson
757 Views, 4 Replies

What event I should use to read left click mouse location all the time?

Hello Coders.

I had a post already , and nobody answered it .Maybe was too complicated

Now I guess if I split my questions, somebody could help me.

I want to be able to read the left click mouse button coordination all the times . Is it possible ?

Regards,

Janet.

 

  

4 REPLIES 4
Message 2 of 5

Hi Janet,

 

Are you looking to monitor the mouse click or mouse move? You mention click but your description sounds like you want to track mouse movements. If you want mouse movements, the best event handler is "Editor.PointMonitor" event in .NET.

 

Monitoring a click can be tricker and you might have to hook into Windows message filter if you want that.

 

Best Regards

 

Gopinath Taget

Message 3 of 5
jeff
in reply to: JanetDavidson

Maybe you could use PointMointer class

 

Maybe Something like

 

 

        <CommandMethod("LastPoint")> _
        Public Sub LastPoint()
            AddHandler Application.DocumentManager.MdiActiveDocument.Editor.PointMonitor, New PointMonitorEventHandler(AddressOf Editor_PointMonitor)
        End Sub

        Private previousPoint As Point3d
        Private Sub Editor_PointMonitor(sender As Object, e As PointMonitorEventArgs)
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor

            Dim lastPoint As Point3d = e.Context.LastPoint

            If (Not lastPoint = Nothing) AndAlso (lastPoint <> previousPoint) Then
                ed.WriteMessage(vbLf & "{0} {1}", lastPoint.X.ToString(), lastPoint.Y.ToString())
                previousPoint = lastPoint
            End If

        End Sub

 

    But Gopinath Taget is much more knowledgeable and probably knows the pitfalls and 'gotchas' of this method.

 

But and entity has GeometricExtents property, and other properties and other methods to figure out if it falls in the rectangle you mentioned in previous post.

You can also find your answers @ TheSwamp
Message 4 of 5

Gopinath and Jeff.

I appreciate your help . Yes that is what I wanted.

Now I can start do something.

Thanks again for all your help .

Woman Happy

 

Jeff . Your Code made me Cry. It works and it is exactly what I want.

 

Regards

Message 5 of 5
jeff
in reply to: JanetDavidson

My code also makes me cry when I look at it.

 

 

 

You can also find your answers @ TheSwamp

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost