如何知道滚动条是否达到最大值 [英] How to know if the Scroll is up to maximum value
问题描述
我在主窗体中创建一个SplitContainer,并为其编写代码,如下所示.当然,我还实现了SplitContainer内部的一些控件,可以轻松移动它们.
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) { }
}
我的问题是:
当我将控件移到TheSC的边缘时,将显示滚动条,然后显示
绘制TheSC.Panel1的滚动条时,应该调用Panel1_Scroll事件,该事件如何得知滚动条是否已达到最大值? (当滚动条达到最大值时,我会设置一些标志.)
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.)
推荐答案
这应该有帮助
This Should Help
if(e.NewValue==ThePanel.HorizontalScroll.Maximum)
{
//Can put your code here
}
在此处输入您的代码:
Putyour code here:
if(e.NewValue==ThePanel.HorizontalScroll.Maximum)
{
//Can put your code here
}
希望对您有所帮助.
Hope this might help you.
这篇关于如何知道滚动条是否达到最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!