how to dispatch own events to controls to simulate mouseclicks in c#? -
how to dispatch own events to controls to simulate mouseclicks in c#? -
is possible in c# dispatch own events controls?
i mean, can in java:
mouseevent leftclick = new mouseevent(image, mouseevent.mouse_pressed, 0, 0, 100, 100, 1, false, mouseevent.button1); image.dispatchevent(leftclick);
events in c# work little differently. instead of dispatching event object, subscribe event object has available , provide delegate. see events (c# vs. java) reference. however, if want run code attached event, can phone call delegate directly, think people consider bad form. may improve have method performs action , phone call both delegate , wherever wanting simulate click event from.
somecontrol.leftmousebuttondown += new leftmousebuttondown(somecontrol_leftmousebuttondown); protected void somecontrol_leftmousebuttondown(object sender, eventargs e) //might typed eventargs instead of generic. { //run code or phone call method. }
preferably, utilize click event instead of leftmousebuttondown click event thrown on leftmousebuttondown , leftmousebuttonup when occur consecutively.
are working command not have leftmousebuttondown or click event? if so, need write own command inherits command , write own event.
also, help if provided details on .net technology using (wpf, winforms, asp.net, silverlight, etc) each has different command set. may helpful know command using technology.
hope helps though!
c# events mouse mouseevent simulate
Comments
Post a Comment