0

Possible Duplicate:
How do I call paint event?

I have a user custom user control which draws some text on its paint event. I am adding this control to a form and at the same time I’m setting the position of the control.

The problem I am having is the paint event doesn’t get fired unless I set the dock style to fill. But I don’t need the dock style to be filled. Is there any way that I can fire the paint event of control manually?

Also any suggestion why the paint event doesn't fire automatically and get fired when the dock style is filled?

Thanks

Community
  • 1
  • 1
huMpty duMpty
  • 14,346
  • 14
  • 60
  • 99
  • _the paint event doesn’t get fired unless I set the dock style to fill_ - that is a bug somewhere that you need to fix. – H H Sep 14 '12 at 09:47
  • can you not "invalidate" the control? I believe this prompts would lead to the control being redrawn which I would guess would lead to a Paint – PeteH Sep 14 '12 at 09:48
  • @Pete: Yes, I did try the **invalidate** but it doesn't – huMpty duMpty Sep 14 '12 at 09:59

1 Answers1

1

You can use

Control.Invalidate();

or

Control.Refresh();

To force a direct paint event

Arthur
  • 138
  • 5
  • 12