Author: pbartok
Date: 2006-01-13 13:28:29 -0500 (Fri, 13 Jan 2006)
New Revision: 55535

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
Log:
2006-01-13  Peter Dennis Bartok  <[EMAIL PROTECTED]>

        * TreeView.cs: Implemented Wheel scrolling. Fixes #76531



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-01-13 18:05:17 UTC (rev 55534)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-01-13 18:28:29 UTC (rev 55535)
@@ -1,3 +1,7 @@
+2006-01-13  Peter Dennis Bartok  <[EMAIL PROTECTED]>
+
+       * TreeView.cs: Implemented Wheel scrolling. Fixes #76531
+
 2006-01-13  Jonathan Chambers  <[EMAIL PROTECTED]>
 
        * PageSetupDialog.cs: Added.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2006-01-13 18:05:17 UTC (rev 55534)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2006-01-13 18:28:29 UTC (rev 55535)
@@ -119,6 +119,7 @@
                        SizeChanged += new EventHandler (SizeChangedHandler);
                        FontChanged += new EventHandler (FontChangedHandler);
                        LostFocus += new EventHandler (LostFocusHandler);
+                       MouseWheel += new MouseEventHandler(MouseWheelHandler);
 
                        SetStyle (ControlStyles.UserPaint | 
ControlStyles.StandardClick, false);
 
@@ -1351,6 +1352,26 @@
                        XplatUI.ScrollWindow (Handle, ViewportRectangle, 
old_offset - hbar_offset, 0, false);
                }
 
+               private void MouseWheelHandler(object sender, MouseEventArgs e) 
{
+                       int scroll_to;
+
+                       if (vbar == null || !vbar.Visible) {
+                               return;
+                       }
+
+                       if (e.Delta < 0) {
+                               // Scrolling down 
"SystemInformation.MouseWheelScrollLines"
+                               // FIXME - put logic here
+                               scroll_to = Math.Min(vbar.Value + 
SystemInformation.MouseWheelScrollLines, vbar.Maximum);
+                       } else {
+                               // Scrolling up 
"SystemInformation.MouseWheelScrollLines"
+                               // FIXME - put logic here
+                               scroll_to = Math.Max(0, vbar.Value - 
SystemInformation.MouseWheelScrollLines);
+                       }
+
+                       vbar.Value = scroll_to;
+               }
+
                private void FontChangedHandler (object sender, EventArgs e)
                {
                        update_node_bounds = true;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to