If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Problem in painting custom panel control (.Net Framework 4.0).

I have inherited the standard panel control to create a panel having custom border color. The problem is, while the panel is on a form and any other form is moved across it, it paints hapazard lines of the same color as the panel custom border color, all throughout background of the panel. I tried to Refresh or Invalidate the panel in its paint event but of no avail. The same is happening while designing in the design editor too. See attached image. Why is this happening and how to get rid of it?
My code follows:

The reason is I draw border for e.ClipRectangle, which may be just a small part of the control that has been invalidated for current paint event. The control's ClientRectangle property needs to be used. For more advanced painting the clip rectangle can be used to only redraw the invalidated area.

Re: Problem in painting custom panel control (.Net Framework 4.0).

i have the same problem: when i want to resize my form with my custom drawn panel it does not refresh the border at all, even when i use me.clientrectangle instead of dim rct as new rectangle(0,0,me.width,me.height)