473,769 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting SmoothingMode.A ntiAlias 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 2668
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
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*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
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

Dec 7 '07 #3

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

Similar topics

1
2585
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 other on a panel. The problem is that each control may have varying amounts of data, and so each RichTextBox (within each control) needs to size to fit the amount of text within that RichTextBox. I've tried multiplying the size of a single line...
1
2497
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 I get: System.ObjectDisposedException: Cannot access a disposed object named "RichTextBox". Object name: "RichTextBox". at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at...
1
3115
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 get the right datatype or anything for it to work..... im trying to stream it.....
0
5088
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 took me 2 hours to figure out! You can set tabs through RichTextBox using the cheesy SelectAll()-> SelectionTabs() method, but that only works after the text has been entered. If the user hits Enter on any line, it goes back and uses the...
1
1683
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 value from combo box after entering of all the details i'll click on one of the command buttons then it will save the contents of the controls which i placed on the richtextbox into a file then i'll click on another command button so it will...
0
968
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 Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit MyBase.OnPaint(e) End Sub
3
7187
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 just add plain (e.g.. rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a different color or font size. Find() will not work because the text will vary. I have delimiters on it so I could recognize it with a regular ...
1
1481
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 result. The second result begins two characters to the right of the first. In an earlier version of the program I did not have this problem. But in that version the RichTextBox actually appeared on a form. In the version of the program with the...
1
1963
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 Well it is something like this richtextbox.rtf = 'databasevalue' but after this statement I notice that the richtextbox.rtf value is not equal to 'databasevalue' Here is my rtf value (from the database)
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.