Hello,
I searched hard but couldn't find an answer to that question : what's
wrong in my code (see below), I'm trying to create an extended
RichTextBox, adding new "things" to be painted into it. I read a way
could be to override WndProc, but another which seems cleaner to me is
to override OnPaint(), which is fired only if UserPaint style is
defined to true. So my code is :
public class RTB : RichTextBox
{
public RTB()
: base()
{
SetStyle(Contro lStyles.UserPai nt, true);
}
protected override void OnPaint(PaintEv entArgs e)
{
base.OnPaint(e) ;
//Whatever I insert here is drawn. Excepted the text !!
}
}
The point is, no text is displayed. I tried overriding none, OnPaint,
OnPaintBackgrou nd, both of them, nothing helped. Since UserPaint is
set, no text is drawn. But if UserPaint isn't set, OnPaint is not
called. How to solve this dilemma ?
Thank you in advance for any help, the only message in newsgroups which
could have help me is :
.... but no answer was given to it...
I searched hard but couldn't find an answer to that question : what's
wrong in my code (see below), I'm trying to create an extended
RichTextBox, adding new "things" to be painted into it. I read a way
could be to override WndProc, but another which seems cleaner to me is
to override OnPaint(), which is fired only if UserPaint style is
defined to true. So my code is :
public class RTB : RichTextBox
{
public RTB()
: base()
{
SetStyle(Contro lStyles.UserPai nt, true);
}
protected override void OnPaint(PaintEv entArgs e)
{
base.OnPaint(e) ;
//Whatever I insert here is drawn. Excepted the text !!
}
}
The point is, no text is displayed. I tried overriding none, OnPaint,
OnPaintBackgrou nd, both of them, nothing helped. Since UserPaint is
set, no text is drawn. But if UserPaint isn't set, OnPaint is not
called. How to solve this dilemma ?
Thank you in advance for any help, the only message in newsgroups which
could have help me is :
.... but no answer was given to it...