BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
BioCore.MouseOperations Class Reference

Classes

struct  MousePoint
 

Public Types

enum  MouseEventFlags {
  LeftDown = 0x00000002 , LeftUp = 0x00000004 , MiddleDown = 0x00000020 , MiddleUp = 0x00000040 ,
  Move = 0x00000001 , Absolute = 0x00008000 , RightDown = 0x00000008 , RightUp = 0x00000010
}
 

Static Public Member Functions

static void LeftClick ()
 
static void RightClick ()
 
static void LeftDown ()
 The function takes the mouse event flag and calls the mouse event function.
 
static void RightDown ()
 It sends a message to the operating system that the right mouse button has been pressed.
 
static void LeftUp ()
 
static void RightUp ()
 
static void SetCursorPosition (int x, int y)
 
static void SetCursorPosition (MousePoint point)
 
static MousePoint GetCursorPosition ()
 
static void MouseEvent (MouseEventFlags value)
 

Detailed Description

Definition at line 119 of file Win32.cs.

Member Enumeration Documentation

◆ MouseEventFlags

Enumerator
LeftDown 
LeftUp 
MiddleDown 
MiddleUp 
Move 
Absolute 
RightDown 
RightUp 

Definition at line 123 of file Win32.cs.

124 {
125 LeftDown = 0x00000002,
126 LeftUp = 0x00000004,
127 MiddleDown = 0x00000020,
128 MiddleUp = 0x00000040,
129 Move = 0x00000001,
130 Absolute = 0x00008000,
131 RightDown = 0x00000008,
132 RightUp = 0x00000010
133 }
static void LeftUp()
Definition Win32.cs:192
static void RightDown()
It sends a message to the operating system that the right mouse button has been pressed.
Definition Win32.cs:186
static void LeftDown()
The function takes the mouse event flag and calls the mouse event function.
Definition Win32.cs:181
static void RightUp()
Definition Win32.cs:198

Member Function Documentation

◆ GetCursorPosition()

static MousePoint BioCore.MouseOperations.GetCursorPosition ( )
static

Get the current mouse position, if it fails, return a point of 0,0

Returns
A MousePoint object.

Definition at line 223 of file Win32.cs.

224 {
225 MousePoint currentMousePoint;
226 var gotPoint = GetCursorPos(out currentMousePoint);
227 if (!gotPoint) { currentMousePoint = new MousePoint(0, 0); }
228 return currentMousePoint;
229 }

◆ LeftClick()

static void BioCore.MouseOperations.LeftClick ( )
static

It sends a message to the operating system that the left mouse button has been pressed and released

Definition at line 170 of file Win32.cs.

171 {
172 MouseEvent(MouseEventFlags.LeftDown | MouseEventFlags.LeftUp);
173 }
static void MouseEvent(MouseEventFlags value)
Definition Win32.cs:235

◆ LeftDown()

static void BioCore.MouseOperations.LeftDown ( )
static

The function takes the mouse event flag and calls the mouse event function.

Definition at line 181 of file Win32.cs.

182 {
183 MouseEvent(MouseEventFlags.LeftDown);
184 }

◆ LeftUp()

static void BioCore.MouseOperations.LeftUp ( )
static

LeftUp() is a function that calls the MouseEvent() function with the MouseEventFlags.LeftUp parameter.

Definition at line 192 of file Win32.cs.

193 {
195 }

◆ MouseEvent()

static void BioCore.MouseOperations.MouseEvent ( MouseEventFlags value)
static

It takes a MouseEventFlags enum value and calls the mouse_event function with the current cursor position

Parameters
MouseEventFlagsThis is the type of mouse event you want to simulate.

Definition at line 235 of file Win32.cs.

236 {
237 MousePoint position = GetCursorPosition();
238
239 mouse_event
240 ((int)value,
241 position.X,
242 position.Y,
243 0,
244 0)
245 ;
246 }
static MousePoint GetCursorPosition()
Definition Win32.cs:223

◆ RightClick()

static void BioCore.MouseOperations.RightClick ( )
static

RightClick() is a function that calls the MouseEvent() function with the MouseEventFlags.RightDown and MouseEventFlags.RightUp flags

Definition at line 176 of file Win32.cs.

177 {
178 MouseEvent(MouseEventFlags.RightDown | MouseEventFlags.RightUp);
179 }

◆ RightDown()

static void BioCore.MouseOperations.RightDown ( )
static

It sends a message to the operating system that the right mouse button has been pressed.

Definition at line 186 of file Win32.cs.

187 {
188 MouseEvent(MouseEventFlags.RightDown);
189 }

◆ RightUp()

static void BioCore.MouseOperations.RightUp ( )
static

RightUp() is a function that calls the MouseEvent() function with the MouseEventFlags.RightUp flag

Definition at line 198 of file Win32.cs.

199 {
201 }

◆ SetCursorPosition() [1/2]

static void BioCore.MouseOperations.SetCursorPosition ( int x,
int y )
static

SetCursorPos(x, y);

Parameters
xThe x coordinate of the cursor.
yThe y coordinate of the cursor.

Definition at line 206 of file Win32.cs.

207 {
208 SetCursorPos(x, y);
209 }

◆ SetCursorPosition() [2/2]

static void BioCore.MouseOperations.SetCursorPosition ( MousePoint point)
static

It takes a MousePoint object, which contains an X and Y coordinate, and sets the cursor position to that point

Parameters
MousePointA struct that contains the X and Y coordinates of the mouse.

Definition at line 215 of file Win32.cs.

216 {
217 SetCursorPos(point.X, point.Y);
218 }

The documentation for this class was generated from the following file: