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

C# Input.MouseWheelEventArgs类代码示例

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

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



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

示例1: MouseWheel

        public static void MouseWheel(Canvas c, TransformGroup tg, MouseWheelEventArgs e)
        {
            int deltaValue;
            deltaValue = e.Delta;
            TranslateTransform tt = (TranslateTransform)tg.Children[1];
            ScaleTransform st = (ScaleTransform)tg.Children[0];
            double xSpot = e.GetPosition(c).X;
            double ySpot = e.GetPosition(c).Y;

            Double x = e.GetPosition(c).X - tt.X;
            Double y = e.GetPosition(c).Y - tt.Y;

            Double centerX = st.CenterX * (st.ScaleX - 1);
            Double centerY = st.CenterY * (st.ScaleY - 1);

            st.CenterX = x;
            st.CenterY = y;

            if (deltaValue > 0)
            {
                st.ScaleX *= 1.25;
                st.ScaleY *= 1.25;
            }
            else
            {

                st.ScaleX *= 0.75;
                st.ScaleY *= 0.75;
            }
        }
开发者ID:fcostacampos,项目名称:WPF-Magnifier,代码行数:30,代码来源:ImagingProvider.cs


示例2: SeeThruListView_PreviewMouseWheel

 void SeeThruListView_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
 {
     e.Handled = true;
     var e2 = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
     e2.RoutedEvent = UIElement.MouseWheelEvent;
     RaiseEvent(e2);
 }
开发者ID:jnhaffey,项目名称:Timekeeper,代码行数:7,代码来源:SeeThruListView.cs


示例3: PlotControl_MouseWheel

        void PlotControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            bool control = (Keyboard.IsKeyDown(Key.LeftCtrl));
            bool shift = (Keyboard.IsKeyDown(Key.LeftShift));

            OnMouseWheel(e.GetPosition(pc), e.Delta, control, shift);
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:7,代码来源:MouseAction.cs


示例4: PreviewMouseWheel

        private static void PreviewMouseWheel(Object sender, MouseWheelEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Control)
            {
                Control zoomableControl = (Control)sender;

                double zoomAmount = (double)zoomableControl.GetValue(ZoomAmountProperty);
                double zoomMinimum = (double)zoomableControl.GetValue(ZoomMinimumProperty);
                double zoomMaximum = (double)zoomableControl.GetValue(ZoomMaximumProperty);

                if (e.Delta > 0)
                    zoomAmount *= 1.1;
                else
                    zoomAmount *= 0.90909090909090906;

                if (zoomAmount > zoomMaximum)
                    zoomAmount = zoomMaximum;
                else if (zoomAmount < zoomMinimum)
                    zoomAmount = zoomMinimum;

                zoomAmount = Math.Round(zoomAmount, 2);

                zoomableControl.SetValue(ZoomAmountProperty, zoomAmount);
            }
        }
开发者ID:jasonjtyler,项目名称:XamDataGrid.Zoomable,代码行数:25,代码来源:MouseWheelZooming.cs


示例5: timelineView_MouseWheel_1

 private void timelineView_MouseWheel_1(object sender, MouseWheelEventArgs e)
 {
     var delta = e.Delta < 0 ? 0.5 : -0.5;
     var newZoom = zoomSlider.Value + delta;
     if (zoomSlider.Minimum <= newZoom && newZoom <= zoomSlider.Maximum)
         zoomSlider.Value = newZoom;
 }
开发者ID:gdlprj,项目名称:duscusys,代码行数:7,代码来源:CustomTimelineWnd.xaml.cs


示例6: OnSelectorPreviewMouseWheel

        private static void OnSelectorPreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (e.Delta == 0)
            {
                // nothing to do
                return;
            }

            var selector = (Selector)sender;
            // get or stored scrollviewer
            var lbScrollViewer = GetScrollViewer(selector);
            if (lbScrollViewer != null)
            {
                var scrollingLines = GetScrollingLines(selector);
                for (var i = 0; i < scrollingLines; i++)
                {
                    if (e.Delta < 0)
                    {
                        lbScrollViewer.LineDown();
                    }
                    else
                    {
                        lbScrollViewer.LineUp();
                    }
                }
                e.Handled = true;
            }
        }
开发者ID:kaushik1605,项目名称:sample_DotNet,代码行数:28,代码来源:SelectorHelper.cs


示例7: ScrollViewer_PreviewMouseWheel

        /// <summary>
        /// Handles the PreviewMouseWheel event of the ScrollViewer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseWheelEventArgs"/> instance containing the event data.</param>
        private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            try
            {
                var scrollviewer = sender as ScrollViewer;
                if (e.Delta > 0)
                {
                    if (scrollviewer != null)
                    {
                        scrollviewer.LineUp();
                    }
                }
                else
                {
                    if (scrollviewer != null)
                    {
                        scrollviewer.LineDown();
                    }
                }

                e.Handled = true;
            }
            catch
            {
                // Do nothing.
            }
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:32,代码来源:HistoryDetailsUserControl.xaml.cs


示例8: OnPreviewMouseWheel

        protected override void OnPreviewMouseWheel(MouseWheelEventArgs args)
        {
            base.OnPreviewMouseWheel(args);
            Transform temptransform;

               // Debug.WriteLine("Mouse wheel " + args.Delta);

               // ImageDisp.LayoutTransform=new ScaleTransform(2.0,2.0) ;

            if (args.Delta > 0)
               dScale+=0.10;

            if (args.Delta < 0)
            {
                dScale -= 0.10;
                if (dScale < 1.0)
                    dScale = 1.0;
            }

             //Debug.WriteLine(" dScale " +dScale);
             //Debug.WriteLine(" ImageDisp.LayoutTransform " + ImageDisp.LayoutTransform);
             ImageDisp.RenderTransform = new ScaleTransform(dScale, dScale,(double)(pixelwidth / 2.0f), (double)(pixelheight / 2.0f));
               ImageDisp.
             Debug.WriteLine("Transform");
             Debug.WriteLine("W " + bmpImage.PixelWidth + " H " + bmpImage.PixelHeight);
             Debug.WriteLine("Dpi X " + bmpImage.DpiX + " Dpi Y " + bmpImage.DpiY);
             Debug.WriteLine("Source X " + bmpImage.SourceRect.X + " Source Y " + bmpImage.SourceRect.Y);

               // ImageDisp.InvalidateMeasure();
            //ImageDisp.InvalidateVisual();
            //ImageDisp.
        }
开发者ID:aweaver,项目名称:PicViewerWPF,代码行数:32,代码来源:Window1.xaml.cs


示例9: CProgressBar_MouseWheel

 private void CProgressBar_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     if (e.Delta > 0)
         Value += Maximum * 0.02;
     else
         Value -= Maximum * 0.02;
 }
开发者ID:Satroki,项目名称:MusicWPF,代码行数:7,代码来源:Classes.cs


示例10: ItemsControl_MouseWheel

        private void ItemsControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            var x = Math.Pow(2, e.Delta / 3.0 / Mouse.MouseWheelDeltaForOneLine);
            _zoomableCanvas.Scale *= x;

            e.Handled = true;
        }
开发者ID:hardborn,项目名称:StadiumBrightnessTool,代码行数:7,代码来源:LocationProfileView.xaml.cs


示例11: MouseWheelInputEventArgs

 public MouseWheelInputEventArgs(IMouseWheelController controller, MouseWheel wheel, MouseWheelEventArgs nativeEventArgs)
   : base(nativeEventArgs.MouseDevice, nativeEventArgs.Timestamp)
 {
   Controller = controller;
   Wheel = wheel;
   NativeEventArgs = nativeEventArgs;
 }
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:7,代码来源:MouseWheelInputEventArgs.cs


示例12: OnMouseWheel

 protected override void OnMouseWheel(MouseWheelEventArgs e)
 {
     if (VerticalScrollBarVisibility != ScrollBarVisibility.Disabled)
     {
         base.OnMouseWheel(e);
     }
 }
开发者ID:nharren,项目名称:MusicTimeline,代码行数:7,代码来源:NonBlockingFlowDocumentScrollViewer.cs


示例13: img_MouseWheel

 private void img_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     if (e.Delta > 0)
         IncreaseZoom();
     else
         DecreaseZoom();
 }
开发者ID:lapuasi,项目名称:china-unicom-player,代码行数:7,代码来源:ImagePage.xaml.cs


示例14: lbMatFile_MouseWheel

 public void lbMatFile_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     if (scrollViewer != null)
     {
         scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - e.Delta);
     }
 }
开发者ID:tuyiherizon,项目名称:TableModifier,代码行数:7,代码来源:InnerStructItemList.xaml.cs


示例15: scroll

 public void scroll(object sender, MouseWheelEventArgs args)
 {
     if (!scrolling)
     {
         if (args.Delta < 120)
         {
             scrollAnimation.From = Canvas.GetTop(tasksItemsControl);
             if (space < tasksItemsControl.Items.Count)
             {
                 scrollAnimation.To = Canvas.GetTop(tasksItemsControl) - 98;
                 space++;
             }
         }
         else
         {
             scrollAnimation.From = Canvas.GetTop(tasksItemsControl);
             if (space > 0)
             {
                 scrollAnimation.To = Canvas.GetTop(tasksItemsControl) + 98;
                 space--;
             }
         }
         scrollAnimation.Completed += new EventHandler((o, a) =>
         {
             scrolling = false;
         });
         scrolling = true;
         tasksItemsControl.BeginAnimation(Canvas.TopProperty, scrollAnimation);
     }
 }
开发者ID:Palethorn,项目名称:Scheduler,代码行数:30,代码来源:Tasks.xaml.cs


示例16: controlMouseWheel

 public void controlMouseWheel(object sender, MouseWheelEventArgs args)
 {
     var img = sender as Image;
     if (img == null) return;
     var transform = (TransformGroup)img.RenderTransform;
     foreach (var child in transform.Children.OfType<ScaleTransform>())
     {
         var delta = args.Delta > 0 ? StepSize : -StepSize;
         var newScale = child.ScaleX + delta;
         if (newScale >= 1)
         {
             child.ScaleX = newScale;
             child.ScaleY = newScale;
             ((ImageParams)img.Tag).Scale = newScale;
         }
     }
     foreach (var translate in transform.Children.OfType<TranslateTransform>())
     {
         var scale = ((ImageParams)img.Tag).Scale;
         var relY = (img.ActualHeight * scale - img.ActualHeight) / 2;
         var relX = (img.ActualWidth * scale - MagicalNumberOfLogic.ActualWidth) / 2;
         if (translate.Y < -relY || translate.Y > relY)
         {
             var step = StepToOriginal(translate.Y, scale, StepSize);
             translate.Y -= step;
         }
         if (translate.X < -relX || translate.X > relX)
         {
             var step = StepToOriginal(translate.X, scale, StepSize);
             translate.X -= step;
         }
     }
 }
开发者ID:Sparin,项目名称:GalleryOfLuna,代码行数:33,代码来源:TransformationLogic.cs


示例17: OnPreviewMouseWheel

        /// <summary>
        /// When user tries to use mouse wheel there can be several cases.
        /// </summary>
        private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            // Case 1: User scrolls the mouse wheel when Shift key is being held down. This 
            // action triggers a horizontal scroll on the library view (so that lengthy names 
            // can be revealed). Setting 'Handled' to 'false' allows the underlying scroll bar
            // to handle the mouse wheel event.
            if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
            {
                e.Handled = false;
                return;
            }

            // Case 2: If the mouse is outside of the library view, but mouse wheel messages 
            // get sent to it anyway. In such case there is nothing to change here. The 'Handled'
            // is not set to 'true' here because the mouse wheel messages should be routed to the 
            // ScrollViewer on tool-tip for further processing.
            if (!(sender as UIElement).IsMouseOver)
                return;

            // Case 3: Mouse wheel without any modifier keys, it scrolls the library view 
            // vertically. In this case 'VerticalOffset' is updated, 'Handled' is also set 
            // so that mouse wheel message routing ends here.
            ScrollViewer scv = (ScrollViewer)sender;
            scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
            e.Handled = true;
        }
开发者ID:RevitLution,项目名称:Dynamo,代码行数:29,代码来源:LibraryView.xaml.cs


示例18: TabControl_PreviewMouseWheel

        private void TabControl_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (e.Delta > 0)
            {
                if (SelectedIndex < Items.Count - 1)
                    SelectedIndex++;
                else
                    SelectedIndex = 0;
            }
            else
            {

                if (SelectedIndex > 0)
                    SelectedIndex--;
                else
                    SelectedIndex = Items.Count - 1;
            }

            if (!_tabPanel.Children[SelectedIndex].IsEnabled)
            {
                if (_tabPanel.Children.OfType<TabItem>().All(x => !x.IsEnabled))
                {
                    SelectedIndex = -1;
                    return;
                }

                TabControl_PreviewMouseWheel(sender, e);
            }

            TabItem_PreviewMouseDown(sender, null);
            ChangeVisibility();
        }
开发者ID:dbremner,项目名称:ScreenToGif,代码行数:32,代码来源:HideableTabControl.cs


示例19: ScaleElement_MouseWheel

		void ScaleElement_MouseWheel(object sender, MouseWheelEventArgs e) {
			if (Keyboard.Modifiers != ModifierKeys.Control)
				return;

			ZoomMouseWheel(e.Delta);
			e.Handled = true;
		}
开发者ID:levisre,项目名称:dnSpy,代码行数:7,代码来源:TabElementScaler.cs


示例20: HandlePreviewMouseWheel

        private static void HandlePreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            var scrollControl = sender as ScrollViewer;
            if (!e.Handled && sender != null && !reentrantList.Contains(e))
            {
                var previewEventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
                {
                    RoutedEvent = UIElement.PreviewMouseWheelEvent,
                    Source = sender
                };
                var originalSource = e.OriginalSource as UIElement;
                reentrantList.Add(previewEventArg);
                if (originalSource!=null) originalSource.RaiseEvent(previewEventArg);
                reentrantList.Remove(previewEventArg);
                // at this point if no one else handled the event in our children, we do our job

                if (!previewEventArg.Handled && ((e.Delta > 0 && scrollControl.VerticalOffset == 0)
                    || (e.Delta <= 0 && scrollControl.VerticalOffset >= scrollControl.ExtentHeight - scrollControl.ViewportHeight)))
                {
                    e.Handled = true;
                    var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
                    eventArg.RoutedEvent = UIElement.MouseWheelEvent;
                    eventArg.Source = sender;
                    var parent = (UIElement)((FrameworkElement)sender).Parent;
                    parent.RaiseEvent(eventArg);
                }
            }
        }
开发者ID:sachokFoX,项目名称:smssender,代码行数:28,代码来源:Code.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Input.QueryCursorEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Input.MouseEventArgs类代码示例发布时间: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