Impovement to gradient panel

Topics: Developer Forum
Dec 21, 2006 at 11:21 AM
Love the controls... One thing that caught my eye in the samples is the flicker problem you have with the gradient panel. I had a similar one that I solved by using my own scroller and adding this :

void CustomScrollbar1_Scroll(object customScroller, CustomControls.CustomScrollEventArgs e)
SendMessage(toolbox1.Handle, WM_SETREDRAW, Convert.ToInt32(false), 0);
panel1.AutoScrollPosition = e.NewValue;
SendMessage(toolbox1.Handle, WM_SETREDRAW, Convert.ToInt32(true), 0);
toolbox1.Invalidate(toolbox1.DisplayRectangle, true);

DllImport("user32.dll", CharSet = CharSet.Auto)
private static extern IntPtr SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, Int32 lParam);
private const int WM_SETREDRAW = 0xB;

This produces flickerfree drawing. I have used it extensively using static background images without a problem. I don't know how you could embed it in your suite but it's a neat trick nevertheless. I ported it from a C++ example from here
Jan 2, 2007 at 7:07 PM
Thank you.

I will look into making these changes. I also need to move the scrollbar inside of any border that may be specified.

Jan 22, 2007 at 11:13 PM
There is a nice article on Codeproject that I think shows a way to put the scrollbar inside your custom control. It involves using one extra panel and one more custom control (or a panel) in your custom control.

Here is the link:

While the guy who wrote it uses it to make his own scrollbar, you could change it and include a standard .NET scrollbar, or maybe a ASCEND.NET.GradientScrollbar?? :-)

You will only have to implement some designer functionality, so the whole 2 extra panels thing will be transparent to the user.

Let me know if it works