Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Infinite vertical scroll (Read 1646 times)
jpinera
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Jul 4th, 2011
Infinite vertical scroll
Jul 7th, 2011 at 3:49pm
Print Post  
I'm trying to manage the vertical scroll using the mous wheel. When the mouse wheel event is raised, I modify the ScrollY property in the diagramView. But even when the bar is at the end, the diagram continue scrolling.

How can I detect the end of the scrollable area?

This is my code (the first part is to control the zoom if the control key is pressed):

Code
Select All
    private void OnMouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
    {
      // Update the drawing based upon the mouse wheel scrolling.
      if (_theControlKeyPressed)
      {
        int factorToIncrese = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
        diagramView.ZoomFactor += factorToIncrese;
        diagramView.Invalidate();
      }
      else
      {
        int factorToIncrese = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
        diagramView.ScrollY -= factorToIncrese;
        if (diagramView.ScrollY <= 0)
          diagramView.ScrollY = 0;
      }
    }
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Infinite vertical scroll
Reply #1 - Jul 7th, 2011 at 4:43pm
Print Post  
Add this after the 0 check:

Code
Select All
diagramView.ScrollY = Math.Min(diagramView.ScrollY,
	diagram.Bounds.Height - diagramView.ClientToDoc(diagramView.ClientRectangle).Height);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jpinera
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Jul 4th, 2011
Re: Infinite vertical scroll
Reply #2 - Jul 8th, 2011 at 6:06am
Print Post  
Thanks a lot, now it is working
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint