Simulate mouse drag
Namespace:
QAliber.Engine.ControlsAssembly: QAliber.Engine (in QAliber.Engine.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# |
|---|
public virtual void Drag( MouseButtons button, Point rel1, Point rel2 ) |
| Visual Basic (Declaration) |
|---|
Public Overridable Sub Drag ( _ button As MouseButtons, _ rel1 As Point, _ rel2 As Point _ ) |
| Visual C++ |
|---|
public: virtual void Drag( MouseButtons button, Point rel1, Point rel2 ) |
Parameters
- button
- Type: System.Windows.Forms..::.MouseButtons
The button to perform the drag with
- rel1
- Type: System.Windows..::.Point
The point in pixels relative to the top left corner of the control, from which to start the drag
- rel2
- Type: System.Windows..::.Point
The point in pixels relative to the top left corner of the control, to end the drag
Examples
Following example will locate will drag a shortcut from you desktop.
Make sure your desktop is visible when you run this sample.
Note the context menu opens in the end.
CopyC#
UIAPane programManager = Desktop.UIA[@"Program Manager", @"Progman", @"UIAPane"] as UIAPane; //Since shortcuts is 2 level below the scope is Descendants UIControl[] myShortcuts = programManager.FindAll( System.Windows.Automation.TreeScope.Descendants, FindProperties.Visible, true); if (myShortcuts != null)//not found above myShortcuts[0].Drag(MouseButtons.Right,new Point(30, 30), new Point(300, 300)); else MessageBox.Show("shortcut Not found");