tags:

views:

49

answers:

2

I have a User Control that has some WinForm Controls inside. I want to be able to paint those inner controls myself (for scrolling purposes, some of them will remain, others will move).

Even when I override the OnPaint and the OnPaintBackground method, those controls keeps showing on my usercontrol which is completely black now because there is no painting methods on it.

Is there a way I can suppress those controls from been painted and then paint them by myself with the DrawToBitmap method of each control?

+1  A: 

Yes. Remove them from (or better yet, never add them to) the UserControl's set of child controls. Simulating interaction with the controls is going to be a PITA, though.

Do you just need the controls to "look" like they're there. Or do they need to actually be there? If its the latter, you would be better off faking the scrolling somehow by just repositioning the controls manually.

Trying to re-invent the windowing system is an exercise in pain. You will be better off if you learn and work within its paradigms.

PeterAllenWebb
yeah is painful, and I haven't found anything really useful online. I would like to see the DatagridView implementation. I mean it supports Custom Controls Painting..
jmayor
+1  A: 

If you don't need interaction, just set every child control .Visible = false.

Otherwise, have you tried WM_SETREDRAW?

danbystrom