List Info

Thread: Painting a custom border on derived panel




Painting a custom border on derived panel
user name
2006-06-30 19:07:40
This should be simple and I've seen lots of suggestions,
but I am still
having problems. I have a control derived from Panel called
BorderedPanel. It has one property, BorderColor and I'm
trying to draw a
single colored border around the control.

OK, this should be easy, right? I have the following code to
do the
drawing:

protected override void OnPaint( PaintEventArgs e )
{
        base.OnPaint( e );
        ControlPaint.DrawBorder( e.Graphics,
e.ClipRectangle,
borderColor, ButtonBorderStyle.Solid );
}


Nothing weird here and the results are fine, until I resize
the panel
quickly or move it off and back on-screen. The result is
extra line
artifacts are seen in the panel itself. The same thing
happens if I have
a the panel scroll. I'm not sure what to do about this. Any
suggestions?
This is different than flickering, so I'm not sure if
double buffering
will help. I can provide a screenshot if needed.

Thanks,

Brian
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )