本文整理汇总了C#中MouseButton类的典型用法代码示例。如果您正苦于以下问题:C# MouseButton类的具体用法?C# MouseButton怎么用?C# MouseButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseButton类属于命名空间,在下文中一共展示了MouseButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseButtonEventArgs
public MouseButtonEventArgs(RoutedEvent routedEvent, object originalSource, MouseDevice mouseDevice, int timestamp, Point absolutePosition, MouseButton changedButton, MouseButtonState buttonState, int clickCount)
: base(routedEvent, originalSource, mouseDevice, timestamp, absolutePosition)
{
this.ChangedButton = changedButton;
this.ButtonState = buttonState;
this.ClickCount = clickCount;
}
示例2: PlainSurfaceItem
public PlainSurfaceItem(int maxWidth, int maxHeight, int widthRequest = 0, int heightRequest = 0, string label = null)
{
//Console.WriteLine ("PlainSurfaceItem");
_label = label;
this._evtBox = new EventBox ();
this._draw = new global::Gtk.DrawingArea ();
if(widthRequest > 0) {
_draw.WidthRequest = widthRequest;
}
if(heightRequest > 0) {
_draw.HeightRequest = heightRequest;
}
this._evtBox.Add (this._draw);
maxWidth = Math.Max (maxWidth, widthRequest);
maxHeight = Math.Max (maxHeight, heightRequest);
this._height = Math.Max(_draw.Allocation.Height, heightRequest);
this._width = Math.Max(_draw.Allocation.Width, widthRequest);
this._mode = DisplayMode.Snapshot;
this._surface = new ImageSurface(Format.Argb32, maxWidth, maxHeight);
this._button = MouseButton.None;
this._background = new Color (1.0, 1.0, 1.0);
_draw.ExposeEvent += DrawExpose;
_evtBox.ButtonPressEvent += DrawButtonPressEvent;
_evtBox.ButtonReleaseEvent += DrawButtonReleaseEvent;
_evtBox.MotionNotifyEvent += DrawMotionNotifyEvent;
}
示例3: OnMouseDrag
public override void OnMouseDrag(float x, float y, float dx, float dy, MouseButton button, List<ModifierKey> modifiers)
{
if (HasFocus)
Focus.OnMouseDrag(x, y, dx, dy, button, modifiers);
else
base.OnMouseDrag(x, y, dx, dy, button, modifiers);
}
示例4: CheckButtonReleased
private void CheckButtonReleased(Func<MouseState, ButtonState> getButtonState, MouseButton button)
{
if (getButtonState(_currentState) == ButtonState.Released &&
getButtonState(_previousState) == ButtonState.Pressed)
{
var args = new MouseEventArgs(_gameTime.TotalGameTime, _previousState, _currentState, button);
if (_mouseDownArgs.Button == args.Button)
{
var clickMovement = DistanceBetween(args.Position, _mouseDownArgs.Position);
// If the mouse hasn't moved much between mouse down and mouse up
if (clickMovement < DragThreshold)
{
if(!_hasDoubleClicked)
MouseClicked.Raise(this, args);
}
else // If the mouse has moved between mouse down and mouse up
{
MouseDragged.Raise(this, args);
}
}
MouseUp.Raise(this, args);
_hasDoubleClicked = false;
_previousClickArgs = args;
}
}
示例5: InputAxisMap
public InputAxisMap(MouseButton button)
{
TriggerType = AxisType.Mouse;
Trigger = button;
SecondTriggerType = AxisType.None;
}
示例6: ProcessMouseButton
private void ProcessMouseButton(MouseButton mouseButton)
{
if(_actionEvaluator.ShouldButtonActionBeFired(mouseButton))
{
FireMouseAction(mouseButton);
}
}
示例7: GetButtonStateFromSystem
internal override MouseButtonState GetButtonStateFromSystem(MouseButton mouseButton)
{
MouseButtonState mouseButtonState = MouseButtonState.Released;
// Security Mitigation: do not give out input state if the device is not active.
if(IsActive)
{
int virtualKeyCode = 0;
switch( mouseButton )
{
case MouseButton.Left:
virtualKeyCode = NativeMethods.VK_LBUTTON;
break;
case MouseButton.Right:
virtualKeyCode = NativeMethods.VK_RBUTTON;
break;
case MouseButton.Middle:
virtualKeyCode = NativeMethods.VK_MBUTTON;
break;
case MouseButton.XButton1:
virtualKeyCode = NativeMethods.VK_XBUTTON1;
break;
case MouseButton.XButton2:
virtualKeyCode = NativeMethods.VK_XBUTTON2;
break;
}
mouseButtonState = ( UnsafeNativeMethods.GetKeyState(virtualKeyCode) & 0x8000 ) != 0 ? MouseButtonState.Pressed : MouseButtonState.Released;
}
return mouseButtonState;
}
示例8: MouseHoldTrigger
public MouseHoldTrigger(Rectangle holdArea, float holdTime = DefaultHoldTime,
MouseButton button = MouseButton.Left)
{
HoldArea = holdArea;
HoldTime = holdTime;
Button = button;
}
示例9: GenericSelectTarget
public GenericSelectTarget(IEnumerable<Actor> subjects, string order, string cursor, MouseButton button)
{
this.subjects = subjects;
this.order = order;
this.cursor = cursor;
expectedButton = button;
}
示例10: GetButtonState
/// <summary>
/// Gets the current state of the specified button from the device from either the underlying system or the StylusDevice
/// </summary>
/// <param name="mouseButton">
/// The mouse button to get the state of
/// </param>
/// <returns>
/// The state of the specified mouse button
/// </returns>
protected MouseButtonState GetButtonState(MouseButton mouseButton)
{
if ( _stylusDevice != null )
return _stylusDevice.GetMouseButtonState(mouseButton, this);
else
return GetButtonStateFromSystem(mouseButton);
}
示例11: GenericSelectTarget
public GenericSelectTarget(IEnumerable<Actor> subjects, string order, string cursor, MouseButton button)
{
Subjects = subjects;
OrderName = order;
Cursor = cursor;
ExpectedButton = button;
}
示例12: MouseButtonEventArgs
public MouseButtonEventArgs(MouseButton button, bool pressed, int x, int y)
{
this.button = button;
this.pressed = pressed;
this.x = x;
this.y = y;
}
示例13: MouseDown
// Event raised on mouse down in the ZoomAndPanControl
public static void MouseDown(object sender, MouseButtonEventArgs e,Panel p, ZoomAndPanControl z)
{
p.Focus();
Keyboard.Focus(p);
mouseButtonDown = e.ChangedButton;
origZoomAndPanControlMouseDownPoint = e.GetPosition(z);
origContentMouseDownPoint = e.GetPosition(p);
if ((Keyboard.Modifiers & ModifierKeys.Shift) != 0 &&
(e.ChangedButton == MouseButton.Left ||
e.ChangedButton == MouseButton.Right))
{
// Shift + left- or right-down initiates zooming mode.
mouseHandlingMode = MouseHandlingMode.Zooming;
}
else if (mouseButtonDown == MouseButton.Left)
{
// Just a plain old left-down initiates panning mode.
mouseHandlingMode = MouseHandlingMode.Panning;
}
if (mouseHandlingMode != MouseHandlingMode.None)
{
// Capture the mouse so that we eventually receive the mouse up event.
z.CaptureMouse();
e.Handled = true;
}
}
示例14: SetButtonStateTo
private void SetButtonStateTo(MouseButton button, SharpDX.Toolkit.Input.ButtonState state)
{
switch (button)
{
case MouseButton.None:
break;
case MouseButton.Left:
left = state;
break;
case MouseButton.Middle:
middle = state;
break;
case MouseButton.Right:
right = state;
break;
case MouseButton.XButton1:
xButton1 = state;
break;
case MouseButton.XButton2:
xButton2 = state;
break;
default:
throw new ArgumentOutOfRangeException("button");
}
}
示例15: ntfyMouseMove
protected void ntfyMouseMove(MouseButton btn, int x, int y)
{
if (onMouseMove != null)
{
onMouseMove.Invoke(btn, x, y);
}
}