本文整理汇总了C#中MouseButtons.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# MouseButtons.HasFlag方法的具体用法?C# MouseButtons.HasFlag怎么用?C# MouseButtons.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MouseButtons
的用法示例。
在下文中一共展示了MouseButtons.HasFlag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Up
public static void Up(int x, int y, MouseButtons buttons)
{
Move(x, y);
MouseEventFlags flags = 0;
if (buttons.HasFlag(MouseButtons.Left)) { flags |= MouseEventFlags.LeftUp; }
if (buttons.HasFlag(MouseButtons.Middle)) { flags |= MouseEventFlags.MiddleUp; }
if (buttons.HasFlag(MouseButtons.Right)) { flags |= MouseEventFlags.RightUp; }
MouseEvent(flags, new Point(x, y));
}
示例2: MouseUpHandler
void MouseUpHandler(object sender, MouseEventArgs e)
{
pressedMouseButtons &= ~e.Button;
if (!pressedMouseButtons.HasFlag(MouseButtons.Left | MouseButtons.Right))
{
dragging = false;
Child.Cursor = Cursors.Arrow;
}
if (!wasDragging) Mode.MouseClicked(new Vector2(e.X,e.Y));
if (pressedMouseButtons == MouseButtons.None) wasDragging = false;
}
示例3: GetButtonsFromNative
/// <summary>
/// Gets the equivalent <see cref="T:DesktopSprites.SpriteManagement.SimpleMouseButtons"/> enumeration from the native button
/// enumeration.
/// </summary>
/// <param name="buttons">The <see cref="T:System.Windows.Forms.MouseButtons"/> enumeration of the mouse button that was pressed.
/// </param>
/// <returns>The equivalent <see cref="T:DesktopSprites.SpriteManagement.SimpleMouseButtons"/> enumeration for this button.
/// </returns>
private static SimpleMouseButtons GetButtonsFromNative(MouseButtons buttons)
{
SimpleMouseButtons simpleButtons = SimpleMouseButtons.None;
if (buttons.HasFlag(MouseButtons.Left))
simpleButtons |= SimpleMouseButtons.Left;
if (buttons.HasFlag(MouseButtons.Right))
simpleButtons |= SimpleMouseButtons.Right;
if (buttons.HasFlag(MouseButtons.Middle))
simpleButtons |= SimpleMouseButtons.Middle;
return simpleButtons;
}
示例4: MouseDownHandler
void MouseDownHandler(object sender, MouseEventArgs e)
{
pressedMouseButtons |= e.Button;
if (pressedMouseButtons.HasFlag(MouseButtons.Left | MouseButtons.Right))
{
dragging = true;
wasDragging = true;
oldMouseX = e.X;
oldMouseY = e.Y;
Child.Cursor = grabbingCursor;
}
}