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


C# Input.StylusEventArgs类代码示例

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


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


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