0
votes

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.

1
WinForms? WebForms? ASP.NET MVC? WPF? ...? - Uwe Keim
@UweKeim WinForms. sorry for not mention that - SamAyoub
@TaW umm, how about using vScrollBar, i mean i transfer value from the panel scrollbar to vScrollBar1 , then hide the panel scroll bar , so i can scroll the panel using vScrollBar1. i'm not really sure if this possible xD - SamAyoub
@TaW i just have alot of button sort in vertical , and i want to put arrow up and arrow down ( buttons) to scroll them, do you have an idea that can help instead of using a panel ? sry for my bad English again, and thanks - SamAyoub

1 Answers

2
votes

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.