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

C# Input.StylusEventArgs类代码示例

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

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



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

示例1: FireNotifications

        /////////////////////////////////////////////////////////////////////

        internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
        { 
            // This is all very sketchy...
            // 
            // Tablet can support multiple stylus devices concurrently.  They can each 
            // be over a different element.  They all update the IsStylusOver property,
            // which calls into here, but ends up using the "current" stylus device, 
            // instead of each using their own device.  Worse, all of these will end up
            // writing to the same bits in the UIElement.  They are going to step all over
            // each other.
            if(Stylus.CurrentStylusDevice == null) 
            {
                return; 
            } 

            StylusEventArgs stylusEventArgs = new StylusEventArgs(Stylus.CurrentStylusDevice, Environment.TickCount); 
            stylusEventArgs.RoutedEvent = oldValue ? Stylus.StylusLeaveEvent : Stylus.StylusEnterEvent;

            if (uie != null)
            { 
                uie.RaiseEvent(stylusEventArgs);
            } 
            else if (ce != null) 
            {
                ce.RaiseEvent(stylusEventArgs); 
            }
            else if (uie3D != null)
            {
                uie3D.RaiseEvent(stylusEventArgs); 
            }
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:33,代码来源:StylusOverProperty.cs


示例2: OnTouchUpHandler

 // Touch up event handler.
 private void OnTouchUpHandler(object sender, StylusEventArgs e)
 {
     // Find the stroke in the collection of the strokes in drawing.
     Stroke stroke;
     if (_activeStrokes.TryGetValue(e.StylusDevice.Id, out stroke))
     {
         FinishStroke(stroke);
     }
 }
开发者ID:RIT-Tool-Time,项目名称:Cascade,代码行数:10,代码来源:MainWindow.xaml.cs


示例3: ProcessMove

        public void ProcessMove(object sender, StylusEventArgs args)
        {
            PictureTracker pictureTracker = GetPictureTracker(args.StylusDevice.Id);

            if (pictureTracker == null)
                return;

            Point location = args.GetPosition(_canvas);
            pictureTracker.ProcessMove(args.StylusDevice.Id, location);
        }
开发者ID:hoozh,项目名称:multi-touch,代码行数:10,代码来源:PictureTrackerManager.cs


示例4: OnLostStylusCapture

        protected override void OnLostStylusCapture(StylusEventArgs args)
        {
            base.OnLostStylusCapture(args);

            // Abnormal end of drawing: Remove child shapes.
            if (isDrawing)
            {
                canv.Children.Remove(polyStylus);
                canv.Children.Remove(polyShadow);
                isDrawing = false;
            }
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:12,代码来源:ShadowTheStylus.cs


示例5: OnTouchDownHandler

        // Touch down event handler.
        private void OnTouchDownHandler(object sender, StylusEventArgs e)
        {

            // If there exist stroke with this ID, finish it.
            Stroke stroke;

            if(_activeStrokes.TryGetValue(e.StylusDevice.Id, out stroke))
            {
                FinishStroke(stroke);
                return;
            }

            // Create new stroke, add point and assign a color to it.
            Stroke newStroke = new Stroke ();
            newStroke.Color = _touchColor.GetColor();
            newStroke.Id = e.StylusDevice.Id;

            // Add new stroke to the collection of strokes in drawing.
            _activeStrokes[newStroke.Id] = newStroke;
        }
开发者ID:RIT-Tool-Time,项目名称:Cascade,代码行数:21,代码来源:MainWindow.xaml.cs


示例6: GetMouseActionsFromStylusEventAndPlaybackCachedDown

        internal RawMouseActions GetMouseActionsFromStylusEventAndPlaybackCachedDown(RoutedEvent stylusEvent, StylusEventArgs stylusArgs)
        {
            if (stylusEvent == Stylus.StylusSystemGestureEvent)
            {
                // See if this is an OK gesture to trigger a mouse event on.
                StylusSystemGestureEventArgs systemGestureArgs = (StylusSystemGestureEventArgs)stylusArgs;
                if (systemGestureArgs.SystemGesture == SystemGesture.Tap ||
                    systemGestureArgs.SystemGesture == SystemGesture.RightTap ||
                    systemGestureArgs.SystemGesture == SystemGesture.Drag ||
                    systemGestureArgs.SystemGesture == SystemGesture.RightDrag ||
                    systemGestureArgs.SystemGesture == SystemGesture.Flick)
                {
                    // Usually UpdateStateForSystemGesture happens in the PreNotify.
                    // And UpdateState for other stylus events happens during mouse promotion.
                    // But with manipulations when events are stored for future promotion,
                    // this difference in order could cause problems. Hence reexecute
                    // UpdateStateForSystemGesture to fix the order.
                    UpdateStateForSystemGesture(systemGestureArgs.SystemGesture, null);

                    if (systemGestureArgs.SystemGesture == SystemGesture.Drag ||
                        systemGestureArgs.SystemGesture == SystemGesture.RightDrag ||
                        systemGestureArgs.SystemGesture == SystemGesture.Flick)
                    {
                        _fBlockMouseMoveChanges = false;
                        TapCount = 1; // reset on a drag or flick.
                        if (systemGestureArgs.SystemGesture == SystemGesture.Flick)
                        {
                            // Don't want to play down or cached moves.
                            _needToSendMouseDown = false;
                        }
                        else
                        {
                            PlayBackCachedDownInputReport(systemGestureArgs.Timestamp);
                        }
                    }
                    else //we have a Tap
                    {
                        PlayBackCachedDownInputReport(systemGestureArgs.Timestamp);
                    }
                }
            }
            else if (stylusEvent == Stylus.StylusInAirMoveEvent)
            {
                return RawMouseActions.AbsoluteMove;
            }
            else if (stylusEvent == Stylus.StylusDownEvent)
            {
                _fLeftButtonDownTrigger = true; // Default to left click until system gesture says otherwise.
                _fBlockMouseMoveChanges = true;
                
                // See if we can promote the mouse button down right now.
                if (_seenDoubleTapGesture || _sawMouseButton1Down)
                {
                    PlayBackCachedDownInputReport(stylusArgs.Timestamp);
                }
            }
            else if (stylusEvent == Stylus.StylusMoveEvent)
            {
                if (!_fBlockMouseMoveChanges)
                {
                    return RawMouseActions.AbsoluteMove;
                }
            }
            else if (stylusEvent == Stylus.StylusUpEvent)
            {
                _fBlockMouseMoveChanges = false;
                _seenDoubleTapGesture = false; // reset this on Stylus Up.
                _sawMouseButton1Down = false; // reset to make sure we don't promote a mouse down on the next stylus down.
                
                if (_promotedMouseState == MouseButtonState.Pressed)
                {
                    _promotedMouseState = MouseButtonState.Released;
                    RawMouseActions actions = _fLeftButtonDownTrigger ? 
                                                    RawMouseActions.Button1Release : 
                                                    RawMouseActions.Button2Release;
                    // Make sure we only promote a mouse up if the mouse is in the down 
                    // state (UpdateMousebuttonState returns true in that case)!
                    if (_stylusLogic.UpdateMouseButtonState(actions))
                    {
                        return actions;
                    }
                    // else - just return default of RawMouseActions.None since we don't want this 
                    //        duplicate mouse up to be processed.
                }
            }

            // Default return
            return RawMouseActions.None;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:89,代码来源:StylusDevice.cs


示例7: circuitInkCanvas_StylusUp

        public void circuitInkCanvas_StylusUp(object sender, StylusEventArgs e)
        {
            if (IsPieMenuVisible)
            {
                PieMenuHitTestEventArgs hitargs = new PieMenuHitTestEventArgs(e.GetPosition(this), e, PieMenuHitTestEventArgs.EventType.Up);
                hitPieMenuHandler(this, hitargs);
            }

            //Make Pie Menu Invisible
            PieMenuEventArgs args = new PieMenuEventArgs(false);
            triggerPieMenuHandler(this, args);

            Point mp2 = e.GetPosition(circuitInkCanvas);

            foreach (UIElement gate in circuitInkCanvas.Children)
            {
                if (gate is Gate)
                {
                    Gate g = gate as Gate;
                    Rect grect = new Rect(g.Margin.Left - 10, g.Margin.Top - 10, g.Width + 10, g.Height + 10);

                    bool condition = false;
                    condition = grect.Contains(mp2);
                    if (condition)
                    {
                        uigate_StylusUp(g ,e);
                        break;
                    }
                }else if(gate is ConnectedWire)
                {
                    HitTestResult result = VisualTreeHelper.HitTest(gate, mp2);
                    if(result != null)
                    {
                        Debug.WriteLine("Hit Test Wire circuitInkCanvas_StylusUp");
                        //Image stroke starts from one terminal and stop at this wire
                        //1. through this wire, create new wire to connect existing wire's 
                        //if stroke starts from input terminal from one gate, then search for input terminal from existing wire.
                        //otherwise stroke starts from the output termianl from one gate, then search for output terminal from existing wire. 
                        ConnectedWire myWire = gate as ConnectedWire;

                        //new wire's destination is mp2; new wire's orignal is ???
                        if (onGateStroke)
                        { 
                            //start the stroke from gate terminal
                            Gate.TerminalID tid = myWire.OriginTerminalID;

                            Gates.Terminal origin = null, dest = null;

                            if (tid.isInput && dragging == DragState.CONNECT_FROM &&
                                !wires.ContainsKey(new Gates.Terminal(tid.ID, tid.abgate)))
                            {
                                origin = new Gates.Terminal(beginTID.ID, beginTID.abgate);
                                dest = new Gates.Terminal(tid.ID, tid.abgate);
                            }


                            if (!tid.isInput && dragging == DragState.CONNECT_TO)
                            {
                                origin = new Gates.Terminal(tid.ID, tid.abgate);
                                dest = new Gates.Terminal(beginTID.ID, beginTID.abgate);

                            }

                            if (origin != null)
                            {
                                c[dest] = origin;
                                UndoRedo.ConnectWire cw = new UndoRedo.ConnectWire(c, origin, dest);

                                if (UndoProvider != null)
                                    UndoProvider.Add(cw);
                            }
                        }
                        break;
                    }
                }
            }

            dragging = DragState.NONE;
            //dragSelect.Width = 0;
            //dragSelect.Height = 0;
            //dragSelect.Margin = new Thickness(0, 0, 0, 0);
            //dragSelect.Visibility = Visibility.Hidden;

            dragWire.Destination = new Point(0, 0);
            dragWire.Origin = new Point(0, 0);

            // unhightlight all
            foreach (Gates.AbstractGate ag in gates.Keys)
            {

                for (int i = 0; i < ag.Output.Length; i++)
                {
                    gates[ag].FindTerminal(false, i).t.Highlight = false;
                }

                for (int i = 0; i < ag.NumberOfInputs; i++)
                {
                    gates[ag].FindTerminal(true, i).t.Highlight = false;
                }
            }
//.........这里部分代码省略.........
开发者ID:buptkang,项目名称:LogicPad,代码行数:101,代码来源:GateInkCanvas.xaml.cs


示例8: circuitInkCanvas_StylusMove

        //pie menu only
        public void circuitInkCanvas_StylusMove(object sender, StylusEventArgs e)
        {
            DateTime now = DateTime.Now;
            StylusPointCollection points = e.GetStylusPoints(this.circuitInkCanvas);
            //check if the current stroke is trigger pie menu stroke
            //debug only
            TimeSpan testSpan = now - _stylusDownTime;

            if(!IsPieMenuVisible)
            {
                if (StrokeAnalyzer.IsTriggerPieMenuStroke(testSpan, StrokeInfo.pointDistance(StartPoint, points[points.Count - 1])))
                {
                    PieMenuEventArgs args = new PieMenuEventArgs(true);
                    args.Position = e.GetPosition(this);
                    triggerPieMenuHandler(this, args);
                    IsPieMenuVisible = true;
                
                    PieMenuHitTestEventArgs hitargs = new PieMenuHitTestEventArgs(e.GetPosition(this), e, PieMenuHitTestEventArgs.EventType.Down);
                    hitPieMenuHandler(this, hitargs);
                }
            }
           
            if(IsPieMenuVisible)
            {
                PieMenuHitTestEventArgs hitargs = new PieMenuHitTestEventArgs(e.GetPosition(this), e, PieMenuHitTestEventArgs.EventType.Move);
                hitPieMenuHandler(this, hitargs);
            }
           
        }     
开发者ID:buptkang,项目名称:LogicPad,代码行数:30,代码来源:GateInkCanvas.xaml.cs


示例9: PreviewStylusMove

 public new void PreviewStylusMove(object sender, StylusEventArgs e)
 {
     
 }
开发者ID:buptkang,项目名称:LogicPad,代码行数:4,代码来源:TruthTableRepresentation.xaml.cs


示例10: button_StylusLeave

 void button_StylusLeave(object sender, StylusEventArgs e)
 {
     Apple hoveredApple;
     var button = sender as KinectCircleButton;
     hoveredApple = myApple[(int)button.Content];
     restoreAppleBackground(hoveredApple);
 }
开发者ID:guozanhua,项目名称:KinectMiniGames,代码行数:7,代码来源:MainWindow.xaml.cs


示例11: OnStylusMove

      protected override void OnStylusMove(StylusEventArgs e)
      {
         base.OnStylusMove(e);
          
         if(TouchEnabled)
         {
            // wpf generates to many events if mouse is over some visual
            // and OnMouseUp is fired, wtf, anyway...
            // http://greatmaps.codeplex.com/workitem/16013
            if((e.Timestamp & Int32.MaxValue) - onMouseUpTimestamp < 55)
            {
               Debug.WriteLine("OnMouseMove skipped: " + ((e.Timestamp & Int32.MaxValue) - onMouseUpTimestamp) + "ms");
               return;
            }

            if(!Core.IsDragging && !Core.mouseDown.IsEmpty)
            {
               Point p = e.GetPosition(this);

               if(MapScaleTransform != null)
               {
                  p = MapScaleTransform.Inverse.Transform(p);
               }

               p = ApplyRotationInversion(p.X, p.Y);

               // cursor has moved beyond drag tolerance
               if(Math.Abs(p.X - Core.mouseDown.X) * 2 >= SystemParameters.MinimumHorizontalDragDistance || Math.Abs(p.Y - Core.mouseDown.Y) * 2 >= SystemParameters.MinimumVerticalDragDistance)
               {
                  Core.BeginDrag(Core.mouseDown);
               }
            }

            if(Core.IsDragging)
            {
               if(!isDragging)
               {
                  isDragging = true;
                  Debug.WriteLine("IsDragging = " + isDragging);
                  cursorBefore = Cursor;
                  Cursor = Cursors.SizeAll;
                  Mouse.Capture(this);
               }

               if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
               {
                  // ...
               }
               else
               {
                  Point p = e.GetPosition(this);

                  if(MapScaleTransform != null)
                  {
                     p = MapScaleTransform.Inverse.Transform(p);
                  }

                  p = ApplyRotationInversion(p.X, p.Y);

                  Core.mouseCurrent.X = (int)p.X;
                  Core.mouseCurrent.Y = (int)p.Y;
                  {
                     Core.Drag(Core.mouseCurrent);
                  }

                  if(IsRotated)
                  {
                     ForceUpdateOverlays();
                  }
                  else
                  {
                     UpdateMarkersOffset();
                  }
               }
               InvalidateVisual();
            }
         }         
      }
开发者ID:MatejHrlec,项目名称:OculusView,代码行数:78,代码来源:GMapControl.cs


示例12: OnStylusInRange

 /// <summary>
 ///     Virtual method reporting the stylus is now in range of the digitizer
 /// </summary>
 protected virtual void OnStylusInRange(StylusEventArgs e) {}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:UIElement.cs


示例13: OnStylusEnter

 /// <summary>
 ///     Virtual method reporting the stylus entered this element
 /// </summary>
 protected virtual void OnStylusEnter(StylusEventArgs e) {}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:UIElement.cs


示例14: OnPreviewStylusInAirMove

 /// <summary>
 ///     Virtual method reporting a stylus-in-air-move
 /// </summary>
 protected virtual void OnPreviewStylusInAirMove(StylusEventArgs e) {}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:UIElement.cs


示例15: SuggestionCanvas_StylusEnter

 void SuggestionCanvas_StylusEnter(object sender, StylusEventArgs e)
 {
     InkCanvas canvas = sender as InkCanvas;
     if (canvas != null)
     {
         canvas.Background = new SolidColorBrush(Colors.LightBlue);
     }
 }
开发者ID:rudi-c,项目名称:htn-stylus,代码行数:8,代码来源:SuggestionsBox.xaml.cs


示例16: OnStylusUp

      protected override void OnStylusUp(StylusEventArgs e)
      {
         base.OnStylusUp(e);
          
         if(TouchEnabled)
         {
            if(isSelected)
            {
               isSelected = false;
            }

            if(Core.IsDragging)
            {
               if(isDragging)
               {
                  onMouseUpTimestamp = e.Timestamp & Int32.MaxValue;
                  isDragging = false;
                  Debug.WriteLine("IsDragging = " + isDragging);
                  Cursor = cursorBefore;
                  Mouse.Capture(null);
               }
               Core.EndDrag();

               if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
               {
                  if(Core.LastLocationInBounds.HasValue)
                  {
                     Position = Core.LastLocationInBounds.Value;
                  }
               }
            }
            else
            {
               Core.mouseDown = GPoint.Empty;
               InvalidateVisual();
            }
         }
      }
开发者ID:MatejHrlec,项目名称:OculusView,代码行数:38,代码来源:GMapControl.cs


示例17: OnPreviewStylusOutOfRange

 /// <summary>
 ///     Virtual method reporting the stylus is now out of range of the digitizer
 /// </summary>
 protected virtual void OnPreviewStylusOutOfRange(StylusEventArgs e) {}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:UIElement.cs


示例18: button_StylusEnter

 void button_StylusEnter(object sender, StylusEventArgs e)
 {
     Apple hoveredApple;
     var button = sender as KinectCircleButton;
     hoveredApple = myApple[(int)button.Content];
     appleHoverBackground(hoveredApple);
 }
开发者ID:guozanhua,项目名称:KinectMiniGames,代码行数:7,代码来源:MainWindow.xaml.cs


示例19: OnGotStylusCapture

 /// <summary>
 ///     Virtual method reporting that this element got the stylus capture
 /// </summary>
 protected virtual void OnGotStylusCapture(StylusEventArgs e) {}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:UIElement.cs


示例20: StylusUp

 public new void StylusUp(object sender, StylusEventArgs e)
 {
     
 }
开发者ID:buptkang,项目名称:LogicPad,代码行数:4,代码来源:TruthTableRepresentation.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Input.TextCompositionEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Input.RoutedUICommand类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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