• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MouseButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MouseButton类属于命名空间,在下文中一共展示了MouseButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: RaiseButtonClickEvent

 // eliminar esto
 public void RaiseButtonClickEvent(Control source, MouseButton button, int index)
 {
     if (this.ButtonClick != null)
     {
         this.ButtonClick(source, new ToolClickEventArgs(button, this, index));
     }
 }
开发者ID:jessaantonio,项目名称:unityforms,代码行数:8,代码来源:ToolButton.cs


示例17: CodeBoundMouse

 public CodeBoundMouse(Action a, MouseButton button, bool pressing = true, bool constant = false)
 {
     Lambda = a;
     BoundMouseButton = button;
     Press = pressing;
     Constant = (pressing) && constant;
 }
开发者ID:arindamGithub,项目名称:Lemma,代码行数:7,代码来源:BoundMouse.cs


示例18: Reset

		public override void Reset()
		{
			button = MouseButton.Left;
			sendEvent = null;
			storeResult = null;
		    inUpdateOnly = true;
		}
开发者ID:RosalieChang,项目名称:hello,代码行数:7,代码来源:GetMouseButtonDown.cs


示例19: MouseClickEntityEventArgs

 public MouseClickEntityEventArgs(int x, int y, MouseButton mouseButton, bool justClicked, bool doubleClicked)
     : base(x, y)
 {
     MouseButton = mouseButton;
     JustClicked = justClicked;
     DoubleClicked = doubleClicked;
 }
开发者ID:shaoleibo,项目名称:YnaEngine,代码行数:7,代码来源:MouseEntityEvents.cs


示例20: TryClickOnBoundingRectangleCenter

        internal static bool TryClickOnBoundingRectangleCenter(
            MouseButton button, 
            CruciatusElement element, 
            bool doubleClick)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            Point point;
            if (!AutomationElementHelper.TryGetBoundingRectangleCenter(element.Instance, out point))
            {
                Logger.Debug("Element '{0}' have empty BoundingRectangle", element);
                return false;
            }

            if (doubleClick)
            {
                CruciatusFactory.Mouse.DoubleClick(button, point.X, point.Y);
            }
            else
            {
                CruciatusFactory.Mouse.Click(button, point.X, point.Y);
            }

            Logger.Info(
                "{0} on '{1}' element at ({2}, {3}) BoundingRectangle center", 
                doubleClick ? "DoubleClick" : "Click", 
                element, 
                point.X, 
                point.Y);
            return true;
        }
开发者ID:Zlabst,项目名称:Winium.Cruciatus,代码行数:34,代码来源:CruciatusCommand.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MouseButtonEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# MouseAxis类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap