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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -