c# - RichTextBox and UserPaint -
i'm trying paint on richtextbox way can calling onpaint/onpaintbackground
.
the problem onpaint or onpaintbackground aren't called unless "userpaint" flag on, when flag on - text won't painted!
how can solve this?
this code use ensure onpaint called after richtextbox has handled painting first:
class myrichtextbox: richtextbox { private const int wm_paint = 15; protected override void wndproc(ref system.windows.forms.message m) { base.wndproc (ref m); if (m.msg == wm_paint && !inhibitpaint) { // raise paint event using (graphics graphic = base.creategraphics()) onpaint(new painteventargs(graphic, base.clientrectangle)); } } private bool inhibitpaint = false; public bool inhibitpaint { set { inhibitpaint = value; } } }
Comments
Post a Comment