I cannot access Position of the cursor (move mouse programatically)

前端 未结 3 905
花落未央
花落未央 2021-01-25 16:34

this is my code:

    private void MoveCursor(int x, int y)
    {
        // Set the Current cursor, move the cursor\'s Position,
        // and set its clipping          


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-25 17:12

    I suggest you this code

    var pc = new PointConverter();
    var pt = new Point();
    pt = (Point)pc.ConvertFromString(string.Format("{0}, {1}",x,y));
    cursorMouse.Position = pt;
    

    link : http://msdn.microsoft.com/en-us/library/system.drawing.pointconverter.aspx

提交回复
热议问题