Question

I have two controls in C# that I override OnPaint() to draw all the visuals myself.

I'd like to add one of those controls inside the other.

What do I put in my parent control's OnPaint() to call the child control's OnPaint()?

Was it helpful?

Solution

You don't specify winforms, but that seems very likely based on your question.

You are presumably calling Invalidate() or Refresh() depending upon your heart's desire.

Refresh() on a control should make the control and its children to repaint.

If you call Invalidate(true) on a control, the child controls should also receive the invalidate message. Invalidate() without the true parameters is not recursive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top