Oh, OnPaintBackground!
-
Ah, apparently if I do this:
SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true);
and then overrideOnPaint
, it should look something like this:protected override void OnPaint(PaintEventArgs pe) { base.OnPaintBackground(pe); base.OnPaint(pe); ... }
Thebase.OnPaintBackground(pe)
being key to a derived class (say, from a Panel) having its background updated properly. I wasn't aware of this before, and it explains some past frustrations with the WinForms. Any feedback and better suggestions welcome. -
Ah, apparently if I do this:
SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true);
and then overrideOnPaint
, it should look something like this:protected override void OnPaint(PaintEventArgs pe) { base.OnPaintBackground(pe); base.OnPaint(pe); ... }
Thebase.OnPaintBackground(pe)
being key to a derived class (say, from a Panel) having its background updated properly. I wasn't aware of this before, and it explains some past frustrations with the WinForms. Any feedback and better suggestions welcome. -
Or just make UserPaint false, then u draw over the background :) The is also a PaintBackground option AFAIK. leppie::AllocCPArticle("Zee blog");
Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.Hmm, I can't find the PaintBackground option. But anyway, I have UserPaint set to true because I want to use DoubleBuffer. It's not exactly clear to me what each other style (e.g. UserPaint, AllPaintingInWmPaint) enables when DoubleBuffer is on. Or, it's not exactly clear to me what I'd lose/gain by making UserPaint false when I have DoubleBuffer on.
-
Hmm, I can't find the PaintBackground option. But anyway, I have UserPaint set to true because I want to use DoubleBuffer. It's not exactly clear to me what each other style (e.g. UserPaint, AllPaintingInWmPaint) enables when DoubleBuffer is on. Or, it's not exactly clear to me what I'd lose/gain by making UserPaint false when I have DoubleBuffer on.