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


C# Input.MouseEventArgs类代码示例

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


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

示例1: mouseZone_MouseMove

        void mouseZone_MouseMove(object sender, MouseEventArgs e)
        {
            if (IsActive)
            {
                _viewport.Cursor = Cursors.None;

                var centerOfViewport = _viewport.PointToScreen(new Point(_viewport.ActualWidth / 2, _viewport.ActualHeight / 2));
                var relativePos = e.MouseDevice.GetPosition(_viewport);
                var actualRelativePos = new Point(relativePos.X - _viewport.ActualWidth / 2, _viewport.ActualHeight / 2 - relativePos.Y);
                var dx = actualRelativePos.X;
                var dy = actualRelativePos.Y;
                _yaw += dx;
                _pitch += dy;
                
                // Rotate
                Rotation = QuaternionHelper.EulerAnglesInDegToQuaternion(_pitch * Sensitivity * 0.1, _yaw * Sensitivity * 0.1, 0);
                
                // Set mouse position back to the center of the viewport in screen coordinates
                MouseUtilities.SetPosition(centerOfViewport);
            }
            else
            {
                _viewport.Cursor = Cursors.Arrow;
            }
        }
开发者ID:Inner-room,项目名称:VrPlayer,代码行数:25,代码来源:MouseTracker.cs

示例2: Slider_OnMouseMove

 private void Slider_OnMouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         ui.ViewModel.WorkspaceViewModel.HasUnsavedChanges = true;
     }
 }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:7,代码来源:DynamoSlider.xaml.cs

示例3: myPath_MouseDown

 private void myPath_MouseDown(object sender, MouseEventArgs e)
 {
     mouseVerticalPosition = e.GetPosition(scene).Y;
     mouseHorizontalPosition = e.GetPosition(scene).X;
     isDragging = true;
     ((Path)sender).CaptureMouse();
 }
开发者ID:redliontom,项目名称:SWP2,代码行数:7,代码来源:AddEllipse.cs

示例4: OnMiddleMouseLeave

		void OnMiddleMouseLeave(object sender, MouseEventArgs e)
		{
			if (e.MiddleButton == MouseButtonState.Pressed)
			{
				MiddleButtonScrollHelper.StopScrolling();
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:GuardZonesView.xaml.cs

示例5: ListViewItem_MouseLeave

 public void ListViewItem_MouseLeave(object sender, MouseEventArgs e)
 {
     ListViewItem listViewItem = (ListViewItem)sender;
     MoveScore moveScore = (MoveScore)listViewItem.Content;
     var viewModel = DataContext as MainViewModel;
     viewModel.UnhighlightMove(moveScore.Move);
 }
开发者ID:MarkByers,项目名称:MyFishSolver,代码行数:7,代码来源:MainWindow.xaml.cs

示例6: OnThrottledMouseMove

 /// <summary>
 /// Raises the ThrottledMouseMove event
 /// </summary>
 protected void OnThrottledMouseMove(MouseEventArgs args)
 {
   if (ThrottledMouseMove != null)
   {
     ThrottledMouseMove(_element, args);
   }
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:10,代码来源:ThrottledMouseEvent.cs

示例7: DoubleClickHandler

        public void DoubleClickHandler(object sender, MouseEventArgs e)
        {
            var selectedTraining = sender as ListBoxItem;
            var training = (Training)selectedTraining.DataContext;

            trainingSelectedEvent(training);
        }
开发者ID:amirben,项目名称:VideoTherapy,代码行数:7,代码来源:UC_TrainingProgramSelection.xaml.cs

示例8: OnMouseMove

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            // if mouse button is not pressed we have no drag operation, ...
            if (e.LeftButton != MouseButtonState.Pressed)
                this.rubberbandSelectionStartPoint = null;

            // ... but if mouse button is pressed and start
            // point value is set we do have one
            if (this.rubberbandSelectionStartPoint.HasValue)
            {
                // create rubberband adorner
                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
                if (adornerLayer != null)
                {
                    RubberbandAdorner adorner = new RubberbandAdorner(this, rubberbandSelectionStartPoint);
                    if (adorner != null)
                    {
                        adornerLayer.Add(adorner);
                    }
                }
            }
            e.Handled = true;
        }
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:DesignerCanvas.cs

示例9: Button_MouseEnter

 private void Button_MouseEnter(object sender, MouseEventArgs e)
 {
     if (((Button)sender).Content != null)
     {
         ((Button)sender).Background = App.Current.Resources["PhoneBorderBrush"] as SolidColorBrush;
     }
 }
开发者ID:trofmike,项目名称:Balda-WP7,代码行数:7,代码来源:MainPage.xaml.cs

示例10: Grip_MouseMove

 private void Grip_MouseMove(object sender, MouseEventArgs e)
 {
     if (Grip.IsMouseCaptured)
     {
         this.Height = e.GetPosition(this).Y;
     }
 }
开发者ID:punker76,项目名称:VCA-player,代码行数:7,代码来源:MainWindow.xaml.cs

示例11: OnMouseMove

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (e.LeftButton != MouseButtonState.Pressed)
                this.dragStartPoint = null;

            if (this.dragStartPoint.HasValue)
            {
                // XamlWriter.Save() has limitations in exactly what is serialized,
                // see SDK documentation; short term solution only;
                string xamlString = XamlWriter.Save(this.Content);
                DragObject dataObject = new DragObject();
                dataObject.Xaml = xamlString;

                WrapPanel panel = VisualTreeHelper.GetParent(this) as WrapPanel;
                if (panel != null)
                {
                    // desired size for DesignerCanvas is the stretched Toolbox item size
                    double scale = 1.3;
                    dataObject.DesiredSize = new Size(panel.ItemWidth * scale, panel.ItemHeight * scale);
                }

                DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy);

                e.Handled = true;
            }
        }
开发者ID:ssickles,项目名称:archive,代码行数:27,代码来源:ToolboxItem.cs

示例12: OnGridPreviewMouseMove

        private void OnGridPreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (CheckIgnoreGridMove.IsChecked == true && !IsButton1Source(e)) return;

            ShowStatus(nameof(OnGridPreviewMouseMove), e);
            e.Handled = CheckStopPreview.IsChecked == true;
        }
开发者ID:CNinnovation,项目名称:WPFWorkshopFeb2016,代码行数:7,代码来源:MainWindow.xaml.cs

示例13: contentView_PreviewMouseMove

        private void contentView_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            var senderObj = sender as ScoreboardControl;

            if (senderObj == null)
            {
                // This shouldn't happen.
                return;
            }

            // Get the current mouse position
            Point mousePos = e.GetPosition(null);
            Vector diff = this.startPoint - mousePos;

            if (e.LeftButton == MouseButtonState.Pressed &&
                (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
                Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
            {
                string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "starboard.xbs");

               if (File.Exists(path) == false)
               {
                   return;
               }

                var strCol = new StringCollection { path };

                var o = new DataObject(DataFormats.FileDrop, strCol);
                o.SetFileDropList(strCol);
                DragDrop.DoDragDrop(senderObj, o, DragDropEffects.Copy);
            }
        }
开发者ID:ascendedguard,项目名称:starboard-dota2,代码行数:32,代码来源:ScoreboardControlPanelView.xaml.cs

示例14: OpenOperationEditWindow

        public void OpenOperationEditWindow(object sender, MouseEventArgs args)
        {
            if (OperationStopwatch != null && OperationStopwatch.ElapsedMilliseconds > 600)
            {
                operationCount = 0;
            }
            if (operationCount == 0)
            {
                OperationStopwatch = Stopwatch.StartNew();
                operationCount++;
            }
            else if (operationCount == 1)
            {
                int elapsedMilliseconds = (int)OperationStopwatch.ElapsedMilliseconds;
                operationCount = 0;
                if (elapsedMilliseconds <= (int)GetDoubleClickTime())
                {
                    TextBlock textBlock = sender as TextBlock;
                    ITestItemViewModel testItemViewModel = textBlock.DataContext as ITestItemViewModel;
                    ICommand editOperationCommand = testItemViewModel.EditOperationCommand;
                    editOperationCommand.Execute(null);

                }
            }
        }
开发者ID:philt5252,项目名称:GoldenHorse,代码行数:25,代码来源:TestDetailsView.xaml.cs

示例15: txbConfig_MouseEnter

 private void txbConfig_MouseEnter(object sender, MouseEventArgs e)
 {
     _descripcion =
         "Cambia el nombre de concurso, las cápsulas informativas, carga los equipos a concursar y las preguntas a usar; la cantidad de tiempo por pregunta y el número de ellas por ronda";
     txbDescripcion.Text = _descripcion;
     //imgPreview.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\config.png"));
 }
开发者ID:Maharba,项目名称:YACM,代码行数:7,代码来源:MainWindow.xaml.cs


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