private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { bMouseDown = true; mouseButton = e.Button; mouseX = e.X; mouseY = e.Y; }
public bool HandleMouseUp(int x, int y, System.Windows.Forms.MouseButtons Button) { if (myCurrentButton != null) { myCurrentButton.Pushing = false; } if (this.ClientRect.Contains(x, y) && Button == System.Windows.Forms.MouseButtons.Left) { foreach (ZYButton myButton in myButtons) { if (myButton.Visible && myButton.Enable) { if (myButton.ButtonRect.Contains(x, y)) { myButton.Pushed = true; myButton.Pushing = false; myCurrentButton = myButton; this.RefreshButtonView(myButton); RaiseOnClick(); myLastButton = myCurrentButton; return(true); } } //if } //foreach } //if return(false); } //public bool HandleMouseUp()
/// <summary> /// Converts a System.Windows.Forms.MouseButtons to OForms.MouseButtons /// </summary> /// <param name="b">Object to convert.</param> /// <returns>Converted buttons.</returns> public static OForms.MouseButtons GetButtons(Forms.MouseButtons b) { OForms.MouseButtons buttons = OForms.MouseButtons.None; if (b.HasFlag(Forms.MouseButtons.Left)) { buttons |= OForms.MouseButtons.Left; } else if (b.HasFlag(Forms.MouseButtons.Middle)) { buttons |= OForms.MouseButtons.Middle; } else if (b.HasFlag(Forms.MouseButtons.Right)) { buttons |= OForms.MouseButtons.Right; } else if (b.HasFlag(Forms.MouseButtons.XButton1)) { buttons |= OForms.MouseButtons.XButton1; } else if (b.HasFlag(Forms.MouseButtons.XButton2)) { buttons |= OForms.MouseButtons.XButton2; } return(buttons); }
private MouseButton?ConvertToWpf(System.Windows.Forms.MouseButtons winformButton) { switch (winformButton) { case MouseButtons.Left: return(MouseButton.Left); case MouseButtons.None: return(null); case MouseButtons.Right: return(MouseButton.Right); case MouseButtons.Middle: return(MouseButton.Middle); case MouseButtons.XButton1: return(MouseButton.XButton1); case MouseButtons.XButton2: return(MouseButton.XButton2); default: throw new ArgumentOutOfRangeException("winformButton"); } }
private WindowsInput.MouseButton ConvertMouseButton(WindowsForms.MouseButtons button) { switch (button) { case WindowsForms.MouseButtons.Left: return(WindowsInput.MouseButton.Left); case WindowsForms.MouseButtons.Right: return(WindowsInput.MouseButton.Right); case WindowsForms.MouseButtons.Middle: return(WindowsInput.MouseButton.Middle); case WindowsForms.MouseButtons.XButton1: return(WindowsInput.MouseButton.XButton1); case WindowsForms.MouseButtons.XButton2: return(WindowsInput.MouseButton.XButton2); // can't map none & can't access MouseButtonEventArgs.ButtonState // todo - use reflection to set button sate, join new MouseButtonEventArgs call & and this method case WindowsForms.MouseButtons.None: return(WindowsInput.MouseButton.XButton2); } throw new InvalidOperationException(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); MsaglMouseEventArgs iArgs = CreateMouseEventArgs(e); gViewer.RaiseMouseDownEvent(iArgs); if (!iArgs.Handled) { currentPressedButton = e.Button; if (currentPressedButton == MouseButtons.Left) { if (ClientRectangle.Contains(PointToClient(MousePosition))) { mouseDownPoint = new Point(e.X, e.Y); if (MouseDraggingMode != DraggingMode.Pan) { zoomWindow = true; } else { mouseDownTransform = gViewer.Transform.Clone(); } } } } }
private void PropertyGrid_MouseDoubleClick(object sender, MouseEventArgs e) { int y = e.Y; Point autoScrollPosition = base.AutoScrollPosition; KeyValuePair <PropertyGrid.Section, PropertyGrid.Item> itemAt = this.getItemAt(y - autoScrollPosition.Y); if (itemAt.Value != null) { this.createEditor(itemAt.Key, itemAt.Value); if ((this.mEditor == null ? false : this.mEditor.Editing != null)) { CustomProperty customProperty = this.mEditor; System.Windows.Forms.MouseButtons button = e.Button; int clicks = e.Clicks; int x = e.X; int num = e.Y; autoScrollPosition = base.AutoScrollPosition; customProperty.DoubleClick(new MouseEventArgs(button, clicks, x, num - autoScrollPosition.Y, e.Delta)); } } else if ((itemAt.Key == null ? false : e.X > this.MarginSize)) { this.closeEditor(true); itemAt.Key.Collapsed = !itemAt.Key.Collapsed; this.recalculateSize(); base.Invalidate(); } }
/// <summary> /// 处理鼠标按钮按下事件 /// </summary> /// <param name="x">鼠标光标在用户界面中的左端位置</param> /// <param name="y">鼠标光标在用户界面中的顶端位置</param> /// <param name="Button">鼠标按钮</param> /// <returns>是否处理的鼠标按钮按下事件</returns> public bool HandleMouseDown(int x, int y, System.Windows.Forms.MouseButtons Button) { if (this.ClientRect.Contains(x, y) && Button == System.Windows.Forms.MouseButtons.Left) { foreach (ZYButton myButton in myButtons) { if (myButton.Visible && myButton.Enable) { if (myButton.ButtonRect.Contains(x, y)) { System.Drawing.Rectangle InvaldRect = myButton.ButtonRect; myButton.Pushing = true; myButton.Pushed = true; myCurrentButton = myButton; this.RefreshButtonView(myButton); foreach (ZYButton myButton2 in myButtons) { if (myButton2.Pushed && myButton2.Visible && myButton2 != myButton) { myButton2.Pushed = false; this.RefreshButtonView(myButton2); } } return(true); } } //if } //foreach } //if return(false); } //public bool HandleMouseDown()
private void pb_3dView_MouseDown(object sender, MouseEventArgs e) { bMouseDown = true; mouseButton = e.Button; mouseX = e.X; mouseY = e.Y; }
public override bool OnMouseDown(Glyph g, System.Windows.Forms.MouseButtons button, System.Drawing.Point mouseLoc) { //MESGlyph mesGlyph = g as MESGlyph; //if (null != mesGlyph) //{ // if (null != _ctrl) // { // IDesignEdit de = _ctrl as IDesignEdit; // if (null != de) // { // if (de.IsEdit) // { // de.EndEdit(); // } // } // } //if (mesGlyph.AdornerMouseDown(button, mouseLoc)) //{ // return true; //} //} _mouseLocation = mouseLoc; return(base.OnMouseDown(g, button, mouseLoc)); }
Mouse.MouseButtons GetButtons(System.Windows.Forms.MouseButtons buttons) { Mouse.MouseButtons retval = Mouse.MouseButtons.None; if ((buttons & System.Windows.Forms.MouseButtons.Left) != 0) { retval |= Mouse.MouseButtons.Primary; } if ((buttons & System.Windows.Forms.MouseButtons.Right) != 0) { retval |= Mouse.MouseButtons.Secondary; } if ((buttons & System.Windows.Forms.MouseButtons.Middle) != 0) { retval |= Mouse.MouseButtons.Middle; } if ((buttons & System.Windows.Forms.MouseButtons.XButton1) != 0) { retval |= Mouse.MouseButtons.ExtraButton1; } if ((buttons & System.Windows.Forms.MouseButtons.XButton2) != 0) { retval |= Mouse.MouseButtons.ExtraButton2; } return(retval); }
public override bool OnMouseUp(Glyph g, System.Windows.Forms.MouseButtons button) { MESGlyph mesGlyph = g as MESGlyph; if (null != mesGlyph) { if (null != _ctrl) { IDesignEdit de = _ctrl as IDesignEdit; if (null != de) { if (de.IsEdit) { de.EndEdit(); } } } if (_mouseLocation != Point.Empty) { if (mesGlyph.AdornerMouseUp(button, _mouseLocation)) { _mouseLocation = Point.Empty; return(true); } } } return(base.OnMouseUp(g, button)); }
private static MouseButtonEventArgs CreateMouseButtonEventArgs( RoutedEvent handler, Forms.MouseButtons button) { MouseButton mouse_button; if (button == Forms.MouseButtons.Left) { mouse_button = MouseButton.Left; } else if (button == Forms.MouseButtons.Right) { mouse_button = MouseButton.Right; } else if (button == Forms.MouseButtons.Middle) { mouse_button = MouseButton.Middle; } else if (button == Forms.MouseButtons.XButton1) { mouse_button = MouseButton.XButton1; } else if (button == Forms.MouseButtons.XButton2) { mouse_button = MouseButton.XButton2; } else { throw new InvalidOperationException(); } return(new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, 0, mouse_button) { RoutedEvent = handler }); }
private void PropertyGrid_MouseMove(object sender, MouseEventArgs e) { if (!this.mMovingDivider) { if ((this.DividerFixed ? true : Math.Abs(e.X - this.DividerPosition) >= 3)) { this.Cursor = Cursors.Default; } else { this.Cursor = Cursors.VSplit; } if ((this.mEditor == null ? false : this.mEditor.Editing != null)) { CustomProperty customProperty = this.mEditor; System.Windows.Forms.MouseButtons button = e.Button; int clicks = e.Clicks; int x = e.X; int y = e.Y; Point autoScrollPosition = base.AutoScrollPosition; customProperty.MouseMove(new MouseEventArgs(button, clicks, x, y - autoScrollPosition.Y, e.Delta)); } } else { this.DividerPosition = e.X; this.DividerPosition = Math.Max(this.DividerPosition, this.MarginSize + base.Width / 6); this.DividerPosition = Math.Min(this.DividerPosition, base.Width - base.Width / 6); base.Invalidate(); } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); MsaglMouseEventArgs iArgs = CreateMouseEventArgs(e); gViewer.RaiseMouseDownEvent(iArgs); if (!iArgs.Handled) { currentPressedButton = e.Button; if (currentPressedButton == System.Windows.Forms.MouseButtons.Left) { if (this.ClientRectangle.Contains(PointToClient(Control.MousePosition))) { this.mouseDownPoint = new System.Drawing.Point(e.X, e.Y); if (this.MouseDraggingMode != DraggingMode.Pan && ZoomEnabled) { zoomWindow = true; } else { mouseDownHVal = gViewer.HVal; mouseDownVVal = gViewer.VVal; } } } } }
} // HandleMouseDown /// <summary> /// 以重载:处理鼠标移动事件 /// </summary> /// <param name="x">鼠标光标在文档中的X坐标</param> /// <param name="y">鼠标光标在文档中的Y坐标</param> /// <param name="Button">鼠标按键</param> /// <returns>是否处理了该事件</returns> /// <seealso>ZYTextDocumentLib.ZYTextElement.HandleMouseMove</seealso> public override bool HandleMouseMove(int x, int y, System.Windows.Forms.MouseButtons Button) { int size = myOwnerDocument.PixelToDocumentUnit(DragBoxSize); if (ShowDragRect()) { System.Drawing.Rectangle[] DragRects = DrectSoft.Library.EmrEditor.Src.Common.DocumentView.GetDragRects(new System.Drawing.Rectangle(this.RealLeft, this.RealTop, this.Width - 1, this.Height - 1), size, true); for (int iCount = 0; iCount < DragRects.Length; iCount++) { if (DragRects[iCount].Contains(x, y)) { System.Windows.Forms.Cursor myCursor = DrectSoft.Library.EmrEditor.Src.Common.DocumentView.GetDragRectCursor(iCount); if (myCursor != null) { myOwnerDocument.SetCursor(myCursor); //myOwnerDocument.SetCursor(Cursors.Cross); //this.OwnerDocument.OwnerControl.Cursor = myCursor; Debug.WriteLine("图片的拖动光标"); } return(true); } } } if (this.Bounds.Contains(x, y)) { myOwnerDocument.SetCursor(System.Windows.Forms.Cursors.Default); } return(false); }
public void Set(System.Windows.Forms.MouseButtons button, bool buttonState) { int bit = ButtonBits[(MouseButtons)button]; int bitSet = (buttonState) ? bit : 0; int bitClear = bit ^ 63; buttonState0 = (buttonState0 & bitClear) | bitSet; }
public void MouseUp(MouseEventArgs e, MouseButtons buttonsAfterwards) { if (buttonsAfterwards == MouseButtons.None) { this._mousePositionLastUp = new Point(e.X, e.Y); this._mouseButtonLastUp = e.Button; } _lastMouseButtons = buttonsAfterwards; }
// Called by ViewController.MouseMove internal void OnMouseMove(ISpatialDisplay sender, IPosition p, System.Windows.Forms.MouseButtons b) { positionLabel.Text = String.Format("{0:0.000}E, {1:0.000}N", p.X, p.Y); if (mnuViewAutoSelect.Checked) { m_Controller.Select(sender, p, SpatialType.Feature); } }
public void MouseDown(MouseEventArgs e) { if (_lastMouseButtons == MouseButtons.None) { this._mousePositionFirstDown = new Point(e.X, e.Y); this._mouseButtonFirstDown = e.Button; } _lastMouseButtons = e.Button; }
public override bool HandleMouseDown(int x, int y, System.Windows.Forms.MouseButtons Button) { //MessageBox.Show("HandleMouseDown"); if (Button == MouseButtons.Right) { contextMenu.Show(Control.MousePosition); } return(base.HandleMouseDown(x, y, Button)); }
public FormMain() { InitializeComponent(); Role.Initialize(); lastBallPosition = new Point(this.Width / 2, this.Height / 2); lastMouseButton = System.Windows.Forms.MouseButtons.None; }
public object StartDrag(ObjectListView olv, System.Windows.Forms.MouseButtons button, OLVListItem item) { var dataObject = new VirtualFileDataObject(); dataObject.SetData(from rowObject in olv.SelectedObjects.Cast <RowObject>() select CreateFileDescriptor(rowObject.Name, rowObject.Binary)); return(dataObject); }
private static MouseButtonEventArgs CreateMouseButtonEventArgs( RoutedEvent handler, Forms.MouseButtons button) { return(new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, 0, ToMouseButton(button)) { RoutedEvent = handler }); }
private void PropertyGrid_MouseDown(object sender, MouseEventArgs e) { Point autoScrollPosition; base.Focus(); if ((this.mEditor == null ? false : this.mEditor.Editing != null)) { if (e.X <= this.DividerPosition + 2) { this.closeEditor(true); } else { CustomProperty customProperty = this.mEditor; System.Windows.Forms.MouseButtons button = e.Button; int clicks = e.Clicks; int x = e.X; int y = e.Y; autoScrollPosition = base.AutoScrollPosition; customProperty.MouseDown(new MouseEventArgs(button, clicks, x, y - autoScrollPosition.Y, e.Delta)); } } if ((this.DividerFixed ? true : Math.Abs(e.X - this.DividerPosition) >= 3)) { int num = e.Y; autoScrollPosition = base.AutoScrollPosition; KeyValuePair <PropertyGrid.Section, PropertyGrid.Item> itemAt = this.getItemAt(num - autoScrollPosition.Y); if (itemAt.Value != null) { this.mFocusedItem = itemAt.Value; this.mFocusedSection = itemAt.Key; this.FirePropertySelected(this.mFocusedSection, this.mFocusedItem); if (e.X > this.DividerPosition) { this.createEditor(itemAt.Key, itemAt.Value); } } else if (itemAt.Key != null) { this.mFocusedItem = null; this.mFocusedSection = itemAt.Key; if (e.X < this.MarginSize) { this.mFocusedSection.Collapsed = !this.mFocusedSection.Collapsed; this.recalculateSize(); } } base.Invalidate(); } else { this.Cursor = Cursors.VSplit; this.mMovingDivider = true; base.Capture = true; } }
/// <summary> /// インターフェースIPaletteToolのメンバー /// </summary> /// <param name="track">編集対象のトラック</param> /// <param name="manager">Cadenciiのマネージャ</param> /// <param name="ids">クリックされたイベントのInternalIDが格納された配列</param> /// <param name="button">クリックされたときのマウスボタン</param> /// <returns></returns> public bool edit(cadencii.vsq.VsqTrack track, int[] ids, System.Windows.Forms.MouseButtons button) { // コントロールカーブの時間方向の解像度を,Cadenciiの設定値から取得 int resol = AppManager.editorConfig.getControlCurveResolutionValue(); for (int i = 0; i < ids.Length; i++) { int internal_id = ids[i]; foreach (var item in track.getNoteEventIterator()) { // 指定されたInternalIDと同じなら,編集する if (item.InternalID == internal_id) { // Brightnessカーブを取得 cadencii.vsq.VsqBPList bri = track.getCurve("BRI"); // 音符の最後の位置でのBRIを取得.処理の最後で追加 int value_at_end = bri.getValue(item.Clock + item.ID.Length); // これから編集しようとしている範囲にすでに値がある場合,邪魔なので削除する bri.keyClockIterator() .Where((clock) => item.Clock <= clock && clock <= item.Clock + item.ID.Length) .ToList() .ForEach((clock) => bri.remove(clock)); // 直前に指定したBRI値.最初はありえない値にしておく int last_v = -1; // 時間方向解像度(resol)ごとのクロックに対して,順次BRIを設定 for (int clock = item.Clock; clock <= item.Clock + item.ID.Length; clock += resol) { // BRIを取得.x=0が音符の先頭,x=1が音符の末尾.getCurve関数は,この仕様を満たすようにBRIを返すように,お好みで定義 float x = (clock - item.Clock) / (float)item.ID.Length; int v = getCurve(x); if (last_v != v) { // 直前に指定した値と違うときだけ追加. bri.add(clock, v); } // 「直前の値」を更新 last_v = v; } // 音符末尾の位置のBRIを強制的に元の値に戻す.これをやらないと, // その音符の末尾以降のBRIがそのまま編集の影響を受けてしまう bri.add(item.Clock + item.ID.Length, value_at_end); break; } } } return(true); }
/// <summary> /// 处理鼠标单击事件 /// </summary> /// <param name="x">鼠标光标在文档中的X坐标</param> /// <param name="y">鼠标光标在文档中的Y坐标</param> /// <param name="Button">鼠标按键</param> /// <returns>是否处理了该事件</returns> /// <seealso>ZYTextDocumentLib.ZYTextElement.HandleClick</seealso> public override bool HandleClick(int x, int y, System.Windows.Forms.MouseButtons Button) { if (this.Bounds.Contains(x, y) && myOwnerDocument.Content.SelectLength == 0) { myOwnerDocument.Content.SetSelection(myOwnerDocument.IndexOf(this), 1); myOwnerDocument.RefreshElement(this); myOwnerDocument.HideCaret(); return(true); } return(false); }
/// <summary> /// Does the action specified by the function /// </summary> /// <param name="button">The button owner of the action</param> /// <param name="clickPoint">The location of the user click on the button</param> /// <param name="mouseButton">The mouse button clicked</param> public void DoAction(BoxButton button, Point clickPoint, System.Windows.Forms.MouseButtons mouseButton) { if (mouseButton == MouseButtons.Left) { OnSendCommand(new SendCommandEventArgs(DefaultCommand.Command, DefaultCommand.UsePrefix)); } else if (mouseButton == MouseButtons.Right) { Menu.Show(button, clickPoint); } }
public MouseButtonDownUpSource( Enums.MouseButtons triggerButton, IPointSource pointSource) { this.triggerButton = (System.Windows.Forms.MouseButtons)triggerButton; //Cast to the Windows.Forms.MouseButtons enum this.pointSource = pointSource; mouseHookListener = new MouseHookListener(new GlobalHooker()) { Enabled = true }; }
public MouseButtonDownUpSource( Enums.MouseButtons triggerButton, IObservable <Timestamped <PointAndKeyValue?> > pointAndKeyValueSource) { this.triggerButton = (System.Windows.Forms.MouseButtons)triggerButton; //Cast to the Windows.Forms.MouseButtons enum this.pointAndKeyValueSource = pointAndKeyValueSource; mouseHookListener = new MouseHookListener(new GlobalHooker()) { Enabled = true }; }
public MouseButtonDownUpSource( Enums.MouseButtons triggerButton, IObservable<Timestamped<PointAndKeyValue?>> pointAndKeyValueSource) { this.triggerButton = (System.Windows.Forms.MouseButtons)triggerButton; //Cast to the Windows.Forms.MouseButtons enum this.pointAndKeyValueSource = pointAndKeyValueSource; mouseHookListener = new MouseHookListener(new GlobalHooker()) { Enabled = true }; }
public void MouseUp(MouseEventArgs e, MouseButtons buttonsAfterwards) { if(buttonsAfterwards==MouseButtons.None) { this._mousePositionLastUp = new Point(e.X,e.Y); this._mouseButtonLastUp = e.Button; } _lastMouseButtons = buttonsAfterwards; }
public void MouseDown(MouseEventArgs e) { if(_lastMouseButtons==MouseButtons.None) { this._mousePositionFirstDown = new Point(e.X,e.Y); this._mouseButtonFirstDown = e.Button; } _lastMouseButtons = e.Button; }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); MsaglMouseEventArgs iArgs = CreateMouseEventArgs(e); gViewer.RaiseMouseDownEvent(iArgs); if (!iArgs.Handled) { currentPressedButton = e.Button; if (currentPressedButton == MouseButtons.Left) if (ClientRectangle.Contains(PointToClient(MousePosition))) { mouseDownPoint = new Point(e.X, e.Y); if (MouseDraggingMode != DraggingMode.Pan) zoomWindow = true; else { mouseDownTransform = gViewer.Transform.Clone(); } } } }