473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Setting SmoothingMode.AntiAlias in a RichTextBox control

RSH
Is it possible to override the onPaint event of the RichTextBox control to
set the smoothing mode to anti-aliased?

If so how do I do it?

I havent been able to find anything about doing this on the web.

Thanks!
Ron
Dec 7 '07 #1
2 2640
On Fri, 07 Dec 2007 13:01:44 -0800, RSH <wa*************@yahoo.comwrote:
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
Dec 7 '07 #2
RSH
Peter,

Thanks for the info!

I'll have a go at it and see what I get.

Thanks!
Ron
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 07 Dec 2007 13:01:44 -0800, RSH <wa*************@yahoo.comwrote:
>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

Dec 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: vanvee | last post by:
Hi I have a user control that contains a RichTextBox in vb.net. In my program, I create multiple instances of this control (with the RichTextBox being in each one), that appear one above the...
1
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later...
1
by: Lasse Edsvik | last post by:
Hello I was wondering if you guys could help me...... I have one textbox, image and one button on a page...... and when I click it im trying to generate a pic and display it.... but I cant...
0
by: Matt | last post by:
This took way to long to figure out - now that I have it working I thought I would share with the group. I've seen tons of posts with very little good answers on this seemingly simple thing that...
1
by: tulasi | last post by:
I am placing textbox controls and combo box controls on richtext box and 2 command buttons on form control. after executing the application i'll place some text into textbox controls and select a...
0
by: Furer Ramon | last post by:
Hello, I want to display all the text in my application in antialias-mode (Only my application!). I can overwrite theOnPaint-Events of all Controls to enable antialias with: Protected...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
1
by: eBob.com | last post by:
After a lot of debugging effort I have to conclude that it does. Or at least can. I take a substring (RichTextBox.Text.Substring) before setting SelectionStart and after and get a different...
1
by: DavidAM | last post by:
In an application I'm loading a RTF value from a database into a richtextbox. After setting the RTF property of the richtextbox control I notice that this value is different than the database value...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.