c# - Mouse position Controlled by ViewList -
so have window application simulates mouse movement, made few tests , managed "record" mouse movement , play once recorded. wanna make viewlist 2 columns ("x" , "y) containing coords of route want mouse follow. coordinates can added throught "ycoord" , "xcoord" textlabels , can added "button1" button viewlist. there's "button2" works "toggle" button turn on , off. so, want that, every time press left click form mouse (lbutton) movement runs long hold button, and, if hold again starts on again. managed textlabels place content viewlist, don't know how read viewlist , convert them mouse movement coords.
thanks in advance help!
you have save x,y coords in list, can create list of points, have iterate , use with:
look @ object cursor
here
also have code:
private void movecursor() { // set current cursor, move cursor's position, // , set clipping rectangle form. this.cursor = new cursor(cursor.current.handle); cursor.position = new point(cursor.position.x - 50, cursor.position.y - 50); cursor.clip = new rectangle(this.location, this.size); }
try this:
public partial class form1 : form { private list<point> _points = null; public form1() { initializecomponent(); _points = new list<point>(); this.mousemove += form1_mousemove; } private void form1_mousemove(object sender, mouseeventargs e) { //save point _points.add(new point(e.x, e.y)); } private void performrecord() { foreach (var point in _points) { this.cursor = new cursor(cursor.current.handle); cursor.position = new point(point.x, point.y); } } private void button1_click(object sender, eventargs e) { performrecord(); } }
Comments
Post a Comment