當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。