Reputation: 3
I'm trying to learn more About C#.
I just have a big problem with scrolling a panel.
I have a panel contains many buttons in Windows form, trying to scroll it with Two Button Scroll up and scroll down.
I search in google I found many codes like this one :
CategoryFlowPanel.AutoScrollPosition =
new Point(0, CategoryFlowPanel.VerticalScroll.Value +
CategoryFlowPanel.VerticalScroll.SmallChange * 7);
I mean something like-
CategoryFlowPanel.AutoScrollPosition = new Point(0, 50);
also I found this :
using (Control c = new Control() { Parent=p, Height = 1, Top = p.ClientSize.Height + pos })
{
p.ScrollControlIntoView(c);
}
and many other but they are working ONLY IF autoscroll is true
and when autoscroll is true the scroll bars will be visible
so my question is -
Is there code can work without autoscroll?
or is there way to hide the scroll bars when autoscroll is true ?
I'm trying to do
Panel.VerticalScroll.Visible = false;
but its not working.
Sorry for my bad English, and Thanks in advance.
Upvotes: 0
Views: 5599
Reputation: 1990
You can scroll WinForms panel without scrollbars being visible by setting HorizontalScroll.Value
and VerticalScroll.Value
programmatically. This approach works with AutoScroll = false
as you need.
Upvotes: 2