Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Maximum scroll position (Read 2569 times)
Darko
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Nov 1st, 2007
Maximum scroll position
Nov 1st, 2007 at 10:49am
Print Post  
Hi,

I'm trying to implement the mouse wheel scrolling to work with the calendar control.
It works, except that the VScrollPos doesn't change if I set it to the value above maximum (or below 0). As I increase/decrease the scroll position with the number specified in the SystemInformation.MouseWheelScrollLines constant (which is usually 3), the scroll position doesn't change if the (maximum scroll position - current scroll postion) is less than 3.

Here is my code:

[code]
void control_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (Math.Abs(e.Delta) == 120)
{
calendar.VScrollPos += -e.Delta * SystemInformation.MouseWheelScrollLines / 120;
}
}[/code]

Is there any way to retrieve the maximum vertical scroll position (or any other solution except for checking whether the value did change or not)?

Thanks,
Darko
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Maximum scroll position
Reply #1 - Nov 1st, 2007 at 12:06pm
Print Post  
It appears that Calendar.VScrollPos and Calendar.HScrollPos do nothing if the specified value is out of the valid scroll range. I have found the following workaround however:

Code
Select All
calendar.ScrollPosition = new Point(

calendar.ScrollPosition.X,

calendar.ScrollPosition.Y + -e.Delta * SystemInformation.MouseWheelScrollLines / 120); 


Regards,
Meppy
  
Back to top
 
IP Logged
 
Darko
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Nov 1st, 2007
Re: Maximum scroll position
Reply #2 - Nov 2nd, 2007 at 12:27pm
Print Post  
Hi,

thanks. It works as it should now.  Smiley

Cheers,
Darko
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint