locked
How to set cursor position ? RRS feed

  • Question



  • hi friends...
    how to set cursor position manualy like auto cad(Cursor move only in grid points)...
    Example the cursor position (e.x,e.y) is 20 , 30 means... the cursor ll indicate position is (30,30)...How can i do this...
    Wednesday, March 5, 2008 2:42 PM

Answers

  • That is because the Cursor position is realtive to screen coordinates. To correctly position it on your MDI Child you need to use this code INSIDE your MDIChild:

     

    Code Snippet

    Cursor.Position = this.PointToScreen(new Point(30, 30));

     

     

    Regards,

    Fábio

    Thursday, March 6, 2008 11:59 AM

All replies

  • Use the cursor Position static property:

     

    Code Snippet

    Cursor.Position = new Point(30, 30);

     

     

    Regards,

    Fábio

    Wednesday, March 5, 2008 3:08 PM

  • hi friend..

              I am set Cursor.Position = new Point(30, 30)  in mdi childform(mouse move event)...But the cursor always in top of MDIPARENT....Can u give me some sample.....

    Thursday, March 6, 2008 4:34 AM
  • That is because the Cursor position is realtive to screen coordinates. To correctly position it on your MDI Child you need to use this code INSIDE your MDIChild:

     

    Code Snippet

    Cursor.Position = this.PointToScreen(new Point(30, 30));

     

     

    Regards,

    Fábio

    Thursday, March 6, 2008 11:59 AM

  • Hi friend,
        I am unable to set cursor position correctly .. Can u send one sample example for cursor movement..
    Saturday, March 15, 2008 7:14 AM