Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I create a SplitContainer in my Main Form, and write code for it as below. Of course, I also have implemeted some controls inside the SplitContainer, and they can be moved without problem.

SplitContainer TheSC = new SplitContainer();
TheSC.Panel1.AutoScroll = true;
TheSC.Panel1.Scroll += new ScrollEventHandler(Panel1_Scroll);
        
void Panel1_Scroll(object sender, ScrollEventArgs e)
{
  Panel ThePanel = (Panel)sender;
  int CheckValue1 = e.NewValue;
  int CheckValue2 = e.OldValue;
  Type TheType = e.GetType();
  if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll) { }

}


My question is :

When I move control to edge of TheSC, the scrollbar will be displayed, and then I
draw the scrollbar of TheSC.Panel1, the Panel1_Scroll event should be invoked, in the event, how can I know if the scrollbar has been up to maximum value ? (I would set some flag when the scrollbar is up to maximum value.)
Posted

This Should Help

if(e.NewValue==ThePanel.HorizontalScroll.Maximum)
{
    //Can put your code here
}
 
Share this answer
 
Comments
Sports Kuo 20-May-11 6:58am    
Thanks of your prompt answer.
Putyour code here:

if(e.NewValue==ThePanel.HorizontalScroll.Maximum)
    {
        //Can put your code here
    }


Hope this might help you.
 
Share this answer
 
Comments
CS2011 20-May-11 6:32am    
i beat you again...Same code :-)
[no name] 20-May-11 7:07am    
Your typing may be fast, so you beat me.
Sports Kuo 20-May-11 6:59am    
Thanks again of your nice answer.
[no name] 20-May-11 7:07am    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900