/// <summary> /// This function is called when the mouse is used to edit an object. You can override /// it to provide custom functionality. /// </summary> /// <param name="operation">The current mouse mode.</param> /// <param name="x">The amount dragged along X.</param> /// <param name="y">The amount dragged along X.</param> /// <param name="z">The amount dragged along X.</param> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { switch (operation) { case MouseOperation.Translate: Translate.X += x; Translate.Y += y; Translate.Z += z; break; case MouseOperation.Rotate: Rotate.X += x; Rotate.Y += y; Rotate.Z += z; break; case MouseOperation.Scale: Scale.X += x; Scale.Y += y; Scale.Z += z; break; } // This modifies the object. modified = true; }
private async Task btnTryClick_ClickAsync(object sender, EventArgs e) { if (lsvScripts.SelectedItems.Count > 0) { var no = int.Parse(lsvScripts.SelectedItems[0].SubItems[0].Text); if (no > 0) { var config = Configs.FirstOrDefault(s => s.No == no); if (config != null) { if (config.IsDisabledTemp) { MessageBox.Show("Script was disabled temporarily!"); } else { var isOk = await MouseOperation.ClickSpeedModeAsync(config.WindowHandle, config); if (!isOk) { MessageBox.Show("Position not found!"); } } } } } }
/// <summary> /// This moves the direction of the normal. /// </summary> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { if (operation == MouseOperation.Translate) { Set(this.x += x, this.y += y, this.z += z); } }
private async Task btnTryClick_ClickAsync(object sender, EventArgs e) { var config = GetConfig(); if (config != null) { if (config.IsDisabledTemp) { MessageBox.Show("Script was disabled temporarily!"); } else { if (config.IsDrag) { await MouseOperation.ClickAndDragAsync(GlobalConfig.WindowHandle, config); } else { var isOk = await MouseOperation.ClickSpeedModeAsync(GlobalConfig.WindowHandle, config); if (!isOk) { MessageBox.Show("Position not found!"); } } } } }
private void BtnFixControl_Click(object sender, EventArgs e) { const short SWP_NOZORDER = 0X4; const int SWP_SHOWWINDOW = 0x0040; if (!string.IsNullOrWhiteSpace(txtClass.Text)) { // Find (the first-in-Z-order) Notepad window. var wHandle = ClickOnPointTool.FindWindow(txtClass.Text, txtName.Text); // If found, position it. if (wHandle != IntPtr.Zero) { //MouseOperation.RECT rct; //GetWindowRect(handle, out rct); //Rectangle screen = Screen.FromHandle(handle).Bounds; //Point pt = new Point(screen.Left + screen.Width / 2 - (rct.Right - rct.Left) / 2, screen.Top + screen.Height / 2 - (rct.Bottom - rct.Top) / 2); // Move the window to (0,0) without changing its size or position // in the Z order. MouseOperation.SetWindowPos(wHandle, IntPtr.Zero, 0, 0, 500, 400, SWP_NOZORDER | SWP_SHOWWINDOW); } } else { MessageBox.Show("Please click on Take Control first!"); } }
public MouseInputEventArgs(MouseEventArgs MouseArgs, KeyEventArgs KeyArgs, MouseOperation Op) { MouseArg = MouseArgs; KeyArg = KeyArgs; Selection = Rectangle.Empty; Tool = Op; }
public MouseInputEventArgs(MouseEventArgs MouseArgs, KeyEventArgs KeyArgs, MouseOperation Op, Rectangle SelectRect) { MouseArg = MouseArgs; KeyArg = KeyArgs; Selection = SelectRect; Tool = Op; }
private async Task TxtYPos_KeyUpAsync(object sender, KeyEventArgs e) { var isXOK = int.TryParse(txtXPos.Text, out int x); var isYOK = int.TryParse(txtYPos.Text, out int y); if (isXOK && isYOK) { var color = MouseOperation.GetColorAt(new Point(x, y)); txtColor1.Text = color.Name; } }
public bool HandleMouseRightButtonUp(Point point) { Node hoveredNode = GetHoveredNode(point, out dragOffsetVector); bool handle; handle = hoveredNode != null?OnMouseRightButtonUpOnNodeOverride(hoveredNode) : OnMouseRightButtonUpOnEmptySpaceOverride(); currentMouseOperation = MouseOperation.None; ActiveNode = null; return(handle); }
private void M_GlobalHook_MouseMove(object sender, MouseEventArgs e) { if (_isStarted) { txtXPos.Text = e.Location.X.ToString(); txtYPos.Text = e.Location.Y.ToString(); txtColor1.Text = MouseOperation.GetColorAt(new Point { X = e.Location.X, Y = e.Location.Y }).Name; } }
/// <summary> /// Конструктор класса обработчика для линии /// </summary> /// <param name="canvas"></param> /// <param name="figureParameters"></param> public LineHandler(PictureBox canvas, FigureParameters figureParameters) { FigureParameters = figureParameters; Canvas = canvas; _line = null; MouseDownDelegate += MouseDown; MouseUpDelegate += MouseUp; MouseMoveDelegate += MouseMove; }
/// <summary> /// Interact. /// </summary> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { if (operation == MouseOperation.Translate) { // push the face. foreach (Index i in indices) { parentpoly.Vertices[i.Vertex].Push(x, y, z); } } }
public bool HandleMouseLeftButtonUp(Point point) { //Node hoveredNode = GetHoveredNode(point, out dragOffsetVector); //if (hoveredNode != null) { // OnMouseLeftButtonUpOnNode(hoveredNode); //} else { bool handle = OnMouseLeftButtonUpOnEmptySpace(); //} currentMouseOperation = MouseOperation.None; ActiveNode = null; return(handle); }
public bool HandleMouseRightButtonDown(Point point) { Node hoveredNode = GetHoveredNode(point, out dragOffsetVector); if (hoveredNode != null) { currentMouseOperation = MouseOperation.MouseRightButtonDownOnNode; ActiveNode = hoveredNode; return(OnMouseRightButtonDownOnNodeOverride(point)); } currentMouseOperation = MouseOperation.MouseRightButtonDownOnEmptySpace; return(OnMouseRightButtonDownOnEmptySpaceOverride(point)); }
void Start() { m_MainCamera = Camera.main; m_UISystem = CoherentUIGTSystem.CurrentUISystem; pointerCursor = GameObject.Find("DefaultCursor"); getControllerStates = GameObject.Find("GameManager").GetComponent <GetControllerStates>(); gameManager = GameObject.Find("GameManager"); mouseOperation = gameManager.GetComponent <MouseOperation>(); getControllerStates = gameManager.GetComponent <GetControllerStates>(); isReadyForNextClick = true; }
private void BtnGetPosition_MouseUp(object sender, MouseEventArgs e) { var point = MouseOperation.GetCursorPosition(); txtXPos.Text = point.X.ToString(); txtYPos.Text = point.Y.ToString(); var color = MouseOperation.GetColorAt(point); txtColor1.Text = color.Name; Cursor.Current = Cursors.Default; }
public bool HandleMouseLeftButtonDown(Point point) { DiagramNode hoveredNode = GetHoveredNode(point, out dragOffsetVector); if (hoveredNode != null) { currentMouseOperation = MouseOperation.MouseLeftButtonDownOnNode; ActiveNode = hoveredNode; ActiveNode.IsPositionControlled = true; return(OnMouseLeftButtonDownOnNodeOverride(point)); } currentMouseOperation = MouseOperation.MouseLeftButtonDownOnEmptySpace; return(OnMouseLeftButtonDownOnEmptySpaceOverride(point)); }
/// <summary> /// Event raised when the user presses down the left mouse-button. /// </summary> private void Control_MouseDown(object sender, MouseButtonEventArgs e) { //If we already are doing an operation, don't start another if (currentMouseOperation != MouseOperation.None) { return; } bool doMouseMovePrep = false; if (e.ChangedButton == MouseButton.Middle) { prePanTimerangeStart = TimeRangeStart; prePanTimerangeEnd = TimeRangeEnd; if (Keyboard.IsKeyDown(Key.LeftCtrl)) { //System.Diagnostics.Debug.WriteLine("Resize"); currentMouseOperation = MouseOperation.Resize; } else { currentMouseOperation = MouseOperation.Pan; //System.Diagnostics.Debug.WriteLine("Pan"); } doMouseMovePrep = true; } else if (e.ChangedButton == MouseButton.Left) { // // Clear selection immediately when starting drag selection. // listBox.SelectedItems.Clear(); isLeftMouseButtonDownOnCanvas = true; origMouseDownPoint = e.GetPosition(GridContainer); currentMouseOperation = MouseOperation.Select; doMouseMovePrep = true; } if (doMouseMovePrep) { origMouseDownPoint = e.GetPosition(GridContainer); GridContainer.CaptureMouse(); listBox.Focus(); Keyboard.Focus(listBox); e.Handled = true; } }
/// <summary> /// Конструктор класса инструмента "Указатель" /// </summary> /// <param name="canvas">Канва</param> /// <param name="figureParameters">Параметры фигуры</param> /// <param name="presenter">Презентер</param> public CursorHandler(PictureBox canvas, Presenter presenter) { Canvas = canvas; _presenter = presenter; _selectedFigure = null; SelectedFigures = new Dictionary <int, BaseFigure>(); BeforeState = new Dictionary <int, BaseFigure>(); BeforePointState = new Dictionary <int, BaseFigure>(); MouseDownDelegate += MouseDown; MouseUpDelegate += MouseUp; MouseMoveDelegate += MouseMoveSelecting; }
/// <summary> /// Event raised when the user releases the left mouse-button. /// </summary> private void Control_MouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { bool wasDragSelectionApplied = false; if (isDraggingSelectionRect) { // // Drag selection has ended, apply the 'selection rectangle'. // isDraggingSelectionRect = false; ApplyDragSelectionRect(); e.Handled = true; wasDragSelectionApplied = true; } if (isLeftMouseButtonDownOnCanvas) { isLeftMouseButtonDownOnCanvas = false; GridContainer.ReleaseMouseCapture(); e.Handled = true; } if (!wasDragSelectionApplied) { // // A click and release in empty space clears the selection. // listBox.SelectedItems.Clear(); } } currentMouseOperation = MouseOperation.None; }
public static extern void mouse_event(MouseOperation dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, UInt32 dwExtraInfo);
/// <summary> /// Interact. /// </summary> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { if(operation == MouseOperation.Translate) { // push the face. foreach(Index i in indices) parentpoly.Vertices[i.Vertex].Push(x, y, z); } }
/// <summary> /// Interact. /// </summary> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { if(operation == MouseOperation.Translate) Set(this.x += x, this.y += y, this.z += z); }
/// <summary> /// This function is called when the mouse is used to edit an object. You can override /// it to provide custom functionality. /// </summary> /// <param name="operation">The current mouse mode.</param> /// <param name="x">The amount dragged along X.</param> /// <param name="y">The amount dragged along X.</param> /// <param name="z">The amount dragged along X.</param> void IInteractable.DoMouseInteract(MouseOperation operation, float x, float y, float z) { switch(operation) { case MouseOperation.Translate: Translate.X += x; Translate.Y += y; Translate.Z += z; break; case MouseOperation.Rotate: Rotate.X += x; Rotate.Y += y; Rotate.Z += z; break; case MouseOperation.Scale: Scale.X += x; Scale.Y += y; Scale.Z += z; break; } // This modifies the object. modified = true; }
private void OnMouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (this.Capture) { this.Capture = false; } if (_op != null) { _op.OnMouseUp(this, e); _op = null; } }
private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (_working != null && e.Button == MouseButtons.Left) { Rectangle previewRect = RectangleMapping.SrcToDst(_working.Size, _previewRect, _selection.Rect); if (previewRect.Contains(e.X, e.Y)) { _op = new MoveRect(); } else { _op = new SelectRect(); } _op.OnMouseDown(this, e); Capture = true; } }
public static extern void mouse_event(MouseOperation dwFlags, uint dx, uint dy, uint dwData, uint dwExtraInfo);
private async Task RunAsync(Configuration.Config config) { //txtProgress.AppendText($"- Script No : {config.No}. Description: {config.Description}. {Environment.NewLine}"); await Task.Delay(config.Delay); lock (padlock) { if (isRun == false) { return; } } // Make Calculator the foreground application and send it // a set of calculations. ClickOnPointTool.SetForegroundWindow(config.WindowHandle); //ClickOnPointTool.ShowActiveWindow(config.WindowHandle); //if (LoadingConfigs != null && LoadingConfigs.Count > 0) //{ // var loadingItem = LoadingConfigs[0]; // var loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos)); // while (loadingColor.Name == loadingItem.ColorName) // { // txtProgress.AppendText($"- Script No : {config.No}. Loading.... {Environment.NewLine}"); // loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos)); // } //} if (config.IsSequential) { if (config.IsDrag) { await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName); } else { await MouseOperation.SendMessageAsync(config.WindowHandle, (int)MouseOperation.MouseEventFlags.LeftDown, 1, config, LoadingConfigs); await MouseOperation.SendMessageAsync(config.WindowHandle, (int)MouseOperation.MouseEventFlags.LeftUp, 0, config, LoadingConfigs); } } else // Speed mode { if (config.IsDrag) { await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName); } else { var isOk = await MouseOperation.ClickSpeedModeAsync(config.WindowHandle, config); if (isOk) { // Do something else if (config.RunOnce) { config.IsDisabledTemp = true; } } } } }