Why does text drawn on a panel disappear?

前端 未结 4 1775
说谎
说谎 2020-12-04 02:12

I\'m trying to draw a text on a panel(The panel has a background picture).

It works brilliant,but when I minimize and then maximize the application the text is gone.

4条回答
  •  我在风中等你
    2020-12-04 03:02

    When you draw something, it only remains until the next time the form is refreshed.

    When the form is refreshed, the Paint event is called. So if you want to ensure your text doesn't disappear, you need to include the code that draws it in the Paint event.

    You can trigger a repaint using Control.Invalidate, but you otherwise cannot predict when they will happen.

提交回复
热议问题