Scrolling a panel via code (without its scrollbars) problem [modified]
-
What i have is a panel (in a windows form, let's call it mypanel) with no active scrollbars (autoscroll set to false). I don't need them and I don't want them to appear. In my code I use
mypanel.HorizontalScroll.Value = value
to scroll the panel. This code appears in the scroll event of another scrollbar in the form. This works fine, except one thing. When I move the slider of the other scrollbar mypanel of course gets repainted. But when repainting the scrollbars of mypanel are painted, too. Of course this is a temporary effect, because they disappear later in the painting cycle. So a painting cycle looks like this: Scrollbars painted, scrollbars removed, .... And this over and over cause I'm dragging a slider so the sroll event occurs many times. This leads to flickering when dragging the slider. So how can I get rid of the scrollbars in mypanel getting painted? Of course I could move the objects in mypanel manually without using the horizontal scroll, but this would be a worse solution. So any help is appreciated. -- modified at 14:28 Sunday 4th June, 2006 -
What i have is a panel (in a windows form, let's call it mypanel) with no active scrollbars (autoscroll set to false). I don't need them and I don't want them to appear. In my code I use
mypanel.HorizontalScroll.Value = value
to scroll the panel. This code appears in the scroll event of another scrollbar in the form. This works fine, except one thing. When I move the slider of the other scrollbar mypanel of course gets repainted. But when repainting the scrollbars of mypanel are painted, too. Of course this is a temporary effect, because they disappear later in the painting cycle. So a painting cycle looks like this: Scrollbars painted, scrollbars removed, .... And this over and over cause I'm dragging a slider so the sroll event occurs many times. This leads to flickering when dragging the slider. So how can I get rid of the scrollbars in mypanel getting painted? Of course I could move the objects in mypanel manually without using the horizontal scroll, but this would be a worse solution. So any help is appreciated. -- modified at 14:28 Sunday 4th June, 2006I did this using a datagrid but the same result will apply. Make an inherited user control that inherits the panel and simply set the width of the vertical scrollbar to 0 (and the height of the horizontal scrollbar). This should give you the hidden scrollbar effect that you want.