On Fri, 07 Dec 2007 13:01:44 -0800, RSH <wa************ *@yahoo.comwrot e:
Is it possible to override the onPaint event of the RichTextBox control
to
set the smoothing mode to anti-aliased?
I doubt it. As a general rule, you cannot affect the drawing of the
common controls in .NET Forms via the OnPaint() method, because the
controls don't use OnPaint() for their actual drawing.
You _might_ able to do something by overriding WndProc and handling the
WM_PAINT. But even there, since you don't have access to the device
context used by the control for drawing, you'd probably have to take over
completely. It's possible you could do this by creating your own buffer
(e.g. a Bitmap instance) and DC (e.g. getting the DC from a Graphics
instance you get from the Bitmap), sending the WM_PRINTCLIENT to the base
control window proc, and then handling the WM_PAINT itself by drawing the
resulting Bitmap to the screen.
But I've never tried it and I have no idea if it would actually work. If
the control does any explicit control over the drawing modes of the DC
that's passed to it, it could wind up just overriding whatever settings
you try to provide. You'd have to try it yourself and see if it works.
Pete