Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple different fonts/font styles/colors within ONE TextBox

0 views
Skip to first unread message

Timo Rosenblatt

unread,
Mar 6, 2002, 1:49:03 AM3/6/02
to
Hello,
now a maybe more complex question...

Is it possible to have a single TextBox with the first 3 characters painted
red, the next 4 characters in black and bold and the rest of the
TextBox.Text in plain black?

My first thought is to implement an own Paint method - but how do I have to
do that?

Thanks a lot in advance,
Timo


Hatim

unread,
Mar 6, 2002, 11:07:59 AM3/6/02
to
hi Timo
for u to have different fonts and colors in the same TextBox u better use a
RichEditBox which can allow that without havig to make ur own paint method
well if u wanna use ur own paint metod here is how to do it
//put this line in the constructor of the class that contain the box
myTextBox.Paint += new PaintEvenHandler(PaintBox);

// add this method
private void PaintBox(object sender, PaintEventArgs e)
{
}

then u can use e.Graphics.DrawString(....) put it a pain in the ass to do
that coz u have to mesure the string and everything ...

Hope this ll help

Hatim


"Timo Rosenblatt" <rosen...@ifap.de> wrote in message
news:#Lv#wrNxBHA.2520@tkmsftngp02...

0 new messages