Repainting issue when scrolling with GradientPanel

Topics: User Forum
Sep 19, 2006 at 5:27 PM
I just started using the Ascend.Net controls. I have a Windows application where a GradientPanel covers the entire main form. It's anchored to all four edges and AutoScroll is turned on.

When I scroll the panel, the graphics get kind of garbled. The gradient color is there for the most part but horizontal lines are left behind from other controls (textboxes and labels, mostly). Also, the background behind the labels becomes a solid color. But if I resize the entire application using the corner of the window, then the gradient goes back to normal.

Is there something in code I have to do to repaint when scrolling?
Coordinator
Sep 19, 2006 at 5:47 PM
I have seen the same thing in my usage of the control. On one of my systems with a powerful video card I don’t see this. With a normal video card I do see this. I’m going to try to optimize this in the next version but I figure it will still come down to video card power.

The best way around this for now is to put what you are scrolling in another control with a transparent background on the gradient background and just auto scroll that control. This will allow the controls contained to scroll but not scroll the gradient background.

Hope this helps.

Scorn
Sep 19, 2006 at 6:44 PM
Thanks for the suggestions. That seems to work as long as the GradientPanel doesn't cover the entire window and is in a fixed position.

I tried putting the GradientPanel on the MainForm and then having the GradientPanel contain a UserControl with a transparent background that contained the rest of the controls. I got the same results with that, plus I got a lot of flicker in the GradientPanel.

I also tried having the MainForm contain a UserControl that contained a GradientPanel that, in turn, contained a transparent Panel that contained the rest of the controls. In that case the GradientPanel couldn't be seen at all. The topmost Panel apparently made the whole thing transparent.
Sep 19, 2006 at 7:14 PM
Oh, I also just saw this:

"Scrolling and gradient backgrounds (coming soon)
A simple form with a gradient background that scrolls the controls but not the gradient."

I guess I'll have to wait until that control to do what I want to do. Great controls, nevertheless. :)
Coordinator
Oct 1, 2006 at 2:26 AM
There is an example for this on the examples page now.

http://www.codeplex.com/Wiki/View.aspx?ProjectName=ASCENDNET&title=Examples