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


C# MouseButton类代码示例

本文整理汇总了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;
 }
开发者ID:highzion,项目名称:Granular,代码行数:7,代码来源:MouseEventArgs.cs

示例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;
        }
开发者ID:codingcave,项目名称:CoupledOdeViewer,代码行数:29,代码来源:PlainSurfaceItem.cs

示例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);
 }
开发者ID:numberoverzero,项目名称:XNA-Engine,代码行数:7,代码来源:Frame.cs

示例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;
            }
        }
开发者ID:EmptyKeys,项目名称:MonoGame.Extended,代码行数:29,代码来源:MouseListener.cs

示例5: InputAxisMap

        public InputAxisMap(MouseButton button)
        {
            TriggerType = AxisType.Mouse;
            Trigger = button;

            SecondTriggerType = AxisType.None;
        }
开发者ID:kourbou,项目名称:Pixel,代码行数:7,代码来源:InputAxisMap.cs

示例6: ProcessMouseButton

 private void ProcessMouseButton(MouseButton mouseButton)
 {
     if(_actionEvaluator.ShouldButtonActionBeFired(mouseButton))
     {
         FireMouseAction(mouseButton);
     }
 }
开发者ID:smoothdeveloper,项目名称:ProceduralGeneration,代码行数:7,代码来源:MouseInputObservable.cs

示例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;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:33,代码来源:Win32MouseDevice.cs

示例8: MouseHoldTrigger

		public MouseHoldTrigger(Rectangle holdArea, float holdTime = DefaultHoldTime,
			MouseButton button = MouseButton.Left)
		{
			HoldArea = holdArea;
			HoldTime = holdTime;
			Button = button;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:MouseHoldTrigger.cs

示例9: GenericSelectTarget

 public GenericSelectTarget(IEnumerable<Actor> subjects, string order, string cursor, MouseButton button)
 {
     this.subjects = subjects;
     this.order = order;
     this.cursor = cursor;
     expectedButton = button;
 }
开发者ID:nevelis,项目名称:OpenRA,代码行数:7,代码来源:GenericSelectTarget.cs

示例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);
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:16,代码来源:MouseDevice.cs

示例11: GenericSelectTarget

		public GenericSelectTarget(IEnumerable<Actor> subjects, string order, string cursor, MouseButton button)
		{
			Subjects = subjects;
			OrderName = order;
			Cursor = cursor;
			ExpectedButton = button;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:GenericSelectTarget.cs

示例12: MouseButtonEventArgs

 public MouseButtonEventArgs(MouseButton button, bool pressed, int x, int y)
 {
     this.button = button;
     this.pressed = pressed;
     this.x = x;
     this.y = y;
 }
开发者ID:pzaps,项目名称:CrossGFX,代码行数:7,代码来源:MouseButtonEventArgs.cs

示例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;
            }
        }
开发者ID:ljubicarizova,项目名称:Chapter3,代码行数:30,代码来源:ZoomAndPanEvents.cs

示例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");
     }
 }
开发者ID:ukitake,项目名称:Stratum,代码行数:25,代码来源:StratumMouseManager.cs

示例15: ntfyMouseMove

 protected void ntfyMouseMove(MouseButton btn, int x, int y)
 {
     if (onMouseMove != null)
     {
         onMouseMove.Invoke(btn, x, y);
     }
 }
开发者ID:IDWMaster,项目名称:3DAPI,代码行数:7,代码来源:Input.cs


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