How to draw a manually drawn control inside a manually drawn control?

StackOverflow https://stackoverflow.com/questions/19190573

  •  30-06-2022
  •  | 
  •  

سؤال

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()?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top