Update a Draw

  • Thread starter Thread starter Luis Arnauth
  • Start date Start date
L

Luis Arnauth

Hello,

I've got a small aplication where i design a small scheme using
System.Drawing.

I need to use a NumericUpDown control to change some text i've draw.

I have all the code under:
protected override void OnPaint(PaintEventArgs paintEvent)

How can i update my draws with new values ?

Thank you

Luis Arnauth
 
Are you drawing directly on the form or is the drawing being done in a
custom control? If it's the form, then when the value of the NumericUpDown
control changes call the Invalidate method on the form, to request a
repaint, and ensure that you're using the value from the NumericUpDown
control in the OnPaint method.
 
I'm drawing directly on the form using

protected override void OnPaint(PaintEventArgs paintEvent)

inside there are some circles and text.
I need to know how to refresh the text portion after the user change some
values.

is the method correct for doing this ?

Luis Arnauth
 
Yes. Just call the Invalidate method on the form when the value has changed
and it will cause the OnPaint method to be called. In the OnPaint method
draw the text.
 
Back
Top