当前位置: 首页>>代码示例>>C#>>正文


C# MouseInputEventArgs类代码示例

本文整理汇总了C#中MouseInputEventArgs的典型用法代码示例。如果您正苦于以下问题:C# MouseInputEventArgs类的具体用法?C# MouseInputEventArgs怎么用?C# MouseInputEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MouseInputEventArgs类属于命名空间,在下文中一共展示了MouseInputEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Device_MouseInput

        void Device_MouseInput(object sender, MouseInputEventArgs e)
        {
            /*
            if ((e.ButtonFlags & MouseButtonFlags.LeftDown) == MouseButtonFlags.LeftDown)
                ButtonPressed(0);
            else if ((e.ButtonFlags & MouseButtonFlags.LeftUp) == MouseButtonFlags.LeftUp)
                ButtonReleased(0);

            if ((e.ButtonFlags & MouseButtonFlags.RightDown) == MouseButtonFlags.RightDown)
                ButtonPressed(1);
            else if ((e.ButtonFlags & MouseButtonFlags.RightUp) == MouseButtonFlags.RightUp)
                ButtonReleased(1);

            if ((e.ButtonFlags & MouseButtonFlags.MiddleDown) == MouseButtonFlags.MiddleDown)
                ButtonPressed(2);
            else if ((e.ButtonFlags & MouseButtonFlags.MiddleUp) == MouseButtonFlags.MiddleUp)
                ButtonReleased(2);

            if ((e.ButtonFlags & MouseButtonFlags.Button4Down) == MouseButtonFlags.Button4Down)
                ButtonPressed(3);
            else if ((e.ButtonFlags & MouseButtonFlags.Button4Up) == MouseButtonFlags.Button4Up)
               ButtonReleased(3);

            if ((e.ButtonFlags & MouseButtonFlags.Button5Down) == MouseButtonFlags.Button5Down)
                ButtonPressed(4);
            else if ((e.ButtonFlags & MouseButtonFlags.Button5Up) == MouseButtonFlags.Button5Up)
                ButtonReleased(4);
            */

            mousePos.X += e.X;
            mousePos.Y += e.Y;
        }
开发者ID:eldernos,项目名称:SlimDXEngine,代码行数:32,代码来源:Mouse.cs

示例2: UpdateInput

 public void UpdateInput(object sender, MouseInputEventArgs e)
 {
     if (MouseMode != e.Mode)
         e.Mode = MouseMode;
     X -= e.X;
     Y -= e.Y;
     WheelDelta += e.WheelDelta;
     if (e.ButtonFlags == MouseButtonFlags.LeftDown)
         LeftButton = ButtonState.Pressed;
     if (e.ButtonFlags == MouseButtonFlags.LeftUp)
         LeftButton = ButtonState.Released;
     if (e.ButtonFlags == MouseButtonFlags.RightDown)
         RightButton = ButtonState.Pressed;
     if (e.ButtonFlags == MouseButtonFlags.RightUp)
         RightButton = ButtonState.Released;
     if (e.ButtonFlags == MouseButtonFlags.MiddleDown)
         MiddleButton = ButtonState.Pressed;
     if (e.ButtonFlags == MouseButtonFlags.MiddleUp)
         MiddleButton = ButtonState.Released;
     if (e.ButtonFlags == MouseButtonFlags.Button4Down)
         Button4 = ButtonState.Pressed;
     if (e.ButtonFlags == MouseButtonFlags.Button4Up)
         Button4 = ButtonState.Released;
     if (e.ButtonFlags == MouseButtonFlags.Button5Down)
         Button5 = ButtonState.Pressed;
     if (e.ButtonFlags == MouseButtonFlags.Button5Up)
         Button5 = ButtonState.Released;
 }
开发者ID:RomanHodulak,项目名称:DeferredLightingD3D11,代码行数:28,代码来源:MouseInput.cs

示例3: MouseUp

 public override bool MouseUp(MouseInputEventArgs e)
 {
     if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
     {
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:8,代码来源:InventorySlotUi.cs

示例4: mouse_MouseInput

 void mouse_MouseInput(object sender, MouseInputEventArgs e)
 {
     buttonsLabel.Text = Enum.Format(typeof(MouseButtonFlags), e.ButtonFlags, "G");
     extraLabel.Text = e.ExtraInformation.ToString(CultureInfo.CurrentCulture);
     rawButtonsLabel.Text = e.RawButtons.ToString(CultureInfo.CurrentCulture);
     locationLabel.Text = new Point(e.X, e.Y).ToString();
     stateLabel.Text = Enum.Format(typeof(MouseMode), e.Mode, "G");
     wheelLabel.Text = e.WheelDelta.ToString(CultureInfo.CurrentCulture);
 }
开发者ID:zhandb,项目名称:slimdx,代码行数:9,代码来源:MainForm.cs

示例5: MouseDown

 public override bool MouseDown(MouseInputEventArgs e)
 {
     if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
     {
         ResetEntity();
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:9,代码来源:CraftSlotUi.cs

示例6: MouseDown

 public override bool MouseDown(MouseInputEventArgs e)
 {
     if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
     {
         if (Clicked != null) Clicked(this);
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:9,代码来源:InventorySlotUi.cs

示例7: MouseUp

 public override bool MouseUp(MouseInputEventArgs e)
 {
     if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)) &&
         IoCManager.Resolve<IUserInterfaceManager>().DragInfo.IsActive)
     {
         if (Dropped != null) Dropped(this);
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:10,代码来源:HotbarSlot.cs

示例8: MouseDown

 public override bool MouseDown(MouseInputEventArgs e)
 {
     if (!Available) return false;
     if (_buttonArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
     {
         if (Clicked != null) Clicked(this);
         Selected = true;
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:11,代码来源:JobSelectButton.cs

示例9: MouseUp

 public override bool MouseUp(MouseInputEventArgs e)
 {
     if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
     {
         if (_userInterfaceManager.DragInfo.IsEntity && _userInterfaceManager.DragInfo.IsActive)
         {
             SetEntity(_userInterfaceManager.DragInfo.DragEntity);
             _userInterfaceManager.DragInfo.Reset();
             return true;
         }
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:13,代码来源:CraftSlotUi.cs

示例10: MouseDown

 public override bool MouseDown(MouseInputEventArgs e)
 {
     if (!IsVisible()) return false;
     if (clientAreaButton.Contains((int) e.Position.X, (int) e.Position.Y))
     {
         dragging = true;
         return true;
     }
     else if (ClientArea.Contains((int) e.Position.X, (int) e.Position.Y))
     {
         return true;
     }
     return false;
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:14,代码来源:Scrollbar.cs

示例11: Device_MouseInput

        public void Device_MouseInput(object sender, MouseInputEventArgs e)
        {
            MousePoint = form.PointToClient(Cursor.Position);
            _mouseDelta.X = e.X;
            _mouseDelta.Y = e.Y;
            MouseWheelDelta = e.WheelDelta;

            if (e.ButtonFlags == MouseButtonFlags.None)
                return;

            MouseButtonFlags mouseFlags = e.ButtonFlags;

            // Don't consider mouse clicks outside of the client area
            if (form.Focused == false || form.ClientRectangle.Contains(MousePoint) == false)
                mouseFlags &= ~(MouseButtonFlags.LeftDown | MouseButtonFlags.RightDown);

            // Find the pressed/unpressed keys
            if (mouseFlags == MouseButtonFlags.LeftDown)
            {
                if ((MouseDown & MouseButtonFlags.LeftDown) != MouseButtonFlags.LeftDown)
                {
                    MouseDown |= MouseButtonFlags.LeftDown;
                    MousePressed |= MouseButtonFlags.LeftDown;
                }
            }
            else if (mouseFlags == MouseButtonFlags.LeftUp)
            {
                MouseDown &= ~MouseButtonFlags.LeftDown;
                MousePressed |= MouseButtonFlags.LeftUp;
            }

            if (mouseFlags == MouseButtonFlags.RightDown)
            {
                if ((MouseDown & MouseButtonFlags.RightDown) != MouseButtonFlags.RightDown)
                {
                    MouseDown |= MouseButtonFlags.RightDown;
                    MousePressed |= MouseButtonFlags.RightDown;
                }
            }
            else if (mouseFlags == MouseButtonFlags.RightUp)
            {
                MouseDown &= ~MouseButtonFlags.RightDown;
                MousePressed |= MouseButtonFlags.RightUp;
            }
        }
开发者ID:WebFreak001,项目名称:BulletSharp,代码行数:45,代码来源:Input.cs

示例12: MouseDown

        public override bool MouseDown(MouseInputEventArgs e)
        {
            if (disposing || !IsVisible()) return false;

            if (closeButton.MouseDown(e)) return true;

            if (base.MouseDown(e)) return true;

            if (titleArea.Contains((int) e.Position.X, (int) e.Position.Y))
            {
                draggingOffset.X = (int) e.Position.X - Position.X;
                draggingOffset.Y = (int) e.Position.Y - Position.Y;
                dragging = true;
                return true;
            }

            return false;
        }
开发者ID:Gartley,项目名称:ss13remake,代码行数:18,代码来源:Window.cs

示例13: MouseEventHandle

 public void MouseEventHandle(object sender, MouseInputEventArgs e)
 {
     mouseDelta.X += e.X;
     mouseDelta.Y += e.Y;
 }
开发者ID:catdawg,项目名称:Ch0nkEngine,代码行数:5,代码来源:MouseComponent.cs

示例14: MouseWheelMove

        public override bool MouseWheelMove(MouseInputEventArgs e)
        {
            var modArgs = new MouseInputEventArgs
                (e.Buttons,
                 e.ShiftButtons,
                 new Vector2D(e.Position.X - Position.X + scrollbarH.Value, e.Position.Y - Position.Y + scrollbarV.Value),
                 e.WheelPosition,
                 e.RelativePosition,
                 e.WheelDelta,
                 e.ClickCount);

            if (inner_focus != null)
            {
                if (inner_focus.MouseWheelMove(modArgs))
                    return true;
                else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
                {
                    scrollbarV.MouseWheelMove(e);
                    return true;
                }
            }
            else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
            {
                scrollbarV.MouseWheelMove(e);
                return true;
            }
            return false;
        }
开发者ID:Gartley,项目名称:ss13remake,代码行数:28,代码来源:ScrollableContainer.cs

示例15: MouseMove

        public override void MouseMove(MouseInputEventArgs e)
        {
            if (disposing || !IsVisible()) return;
            scrollbarH.MouseMove(e);
            scrollbarV.MouseMove(e);

            var modArgs = new MouseInputEventArgs
                (e.Buttons,
                 e.ShiftButtons,
                 new Vector2D(e.Position.X - Position.X + scrollbarH.Value, e.Position.Y - Position.Y + scrollbarV.Value),
                 e.WheelPosition,
                 e.RelativePosition,
                 e.WheelDelta,
                 e.ClickCount);

            foreach (GuiComponent component in components)
                component.MouseMove(modArgs);

            return;
        }
开发者ID:Gartley,项目名称:ss13remake,代码行数:20,代码来源:ScrollableContainer.cs


注:本文中的MouseInputEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。