473,774 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Antialiasing the text in Windows Forms Controls

RSH
I have been experimenting with overriding the Paint event on Win Form
controls...more specifically trying to force the text to render as
Antialiased text. I have not been successful in any of the methods Ive
tried...is there a trick? Any information or examples would be greatly
appreciated.

Thanks!
Ron
Jan 21 '08 #1
2 7010
Ron,

What is the call to DrawString that you are making? Are you setting the
TextRenderingHi nt property on the Graphics instance you are using to draw to
the form?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"RSH" <wa************ *@yahoo.comwrot e in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I have been experimenting with overriding the Paint event on Win Form
controls...mor e specifically trying to force the text to render as
Antialiased text. I have not been successful in any of the methods Ive
tried...is there a trick? Any information or examples would be greatly
appreciated.

Thanks!
Ron
Jan 21 '08 #2
RSH
Nicholas,

Here is what I have pieced together so far. My problem is that I see both
the text that was set in the label1.Text property, as well as my formatted
text. I cant figure out how to get rid of the previous text as setting the
label1.Text property = ""; erases all text.

private void SmoothingFonts_ Paint(object sender,
System.Windows. Forms.PaintEven tArgs e)

{

Label lbl = (Label)sender;

Font TextFont = new Font("Arial", 12, FontStyle.Regul ar);

e.Graphics.Text RenderingHint = TextRenderingHi nt.AntiAlias;

int height = lbl.Size.Height + 20;

int width = lbl.Size.Width + 500;

Size size = new Size(width, height);

Rectangle rect = new Rectangle(lbl.L ocation, size);

e.Graphics.Draw String(lbl.Text , TextFont, Brushes.White,
lbl.ClientRecta ngle);

}

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:9B******** *************** ***********@mic rosoft.com...
Ron,

What is the call to DrawString that you are making? Are you setting
the TextRenderingHi nt property on the Graphics instance you are using to
draw to the form?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"RSH" <wa************ *@yahoo.comwrot e in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>>I have been experimenting with overriding the Paint event on Win Form
controls...mo re specifically trying to force the text to render as
Antialiased text. I have not been successful in any of the methods Ive
tried...is there a trick? Any information or examples would be greatly
appreciated .

Thanks!
Ron

Jan 21 '08 #3

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

Similar topics

5
5333
by: Park | last post by:
In the multiple line textbox, is it possible that every sentences shows different color ? For example, test sentence 1 : red test sentence 2 : blue ....
9
4777
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and DataSet; and all I'm doing is showing one record in text fields, allowing the user to modify the text fields, and then updating the database again when the user clicks the Save button. The fields already show the correct data record since I have...
8
10101
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for a text box has 6 items, undo, cut, copy, paste, delete and select all. I would like to add one additional paste menu that opens a new sub menu with several optional text items that could be pasted. The items would be populated by my program but...
4
2632
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
6
4210
by: Lance Geeck | last post by:
I have a simple form where I am using a dataset called Client. On the data entry screen, there are name, address, city state and zip. I have the fields bound to the dataset field. (Properties screen: Data bindings then Text ) When I run the program and make a change to an existing record in the City text box, the Dataset value for this column is changed as expected. When I check the HasChanges property it says false. I don't...
11
2145
by: F. Michael Miller | last post by:
I'd like to copy the listing of a directory (& sub directories) to a text file in vb.net. I'm looking for teh equivilant of the DOS command dir /s > TargetFile.txt. Thanks!
7
4229
by: Andrew McKendrick | last post by:
Hi, I've noticed a bug in VB.NET (latest .NET Framework)... - I have a TabControl on a form with several tabs. - Each tab contains text boxes that are bound to fields in a data source (DataBindings). - When I display a record and then try to access the .Text property of one of the text boxes on any tab except the current tab, the result is an Empty string.
3
1712
by: Guid | last post by:
Bonjour, je cherche un moyen d'appliquer un anti aliasing sur l'ensemble de mon application. Actuellement je suis a meme de le faire sur chaque controle en redefinissant la methode paint. Cela impliquerai que je dois redefinir chaque control ... c'est balo ! exemple : protected override void OnPaint(PaintEventArgs pe)
0
2729
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only, cannot serch by combine 3 table) Example I have the query table below, how do I make the code to seach based on the query from this: SELECT Product.ID, Product.Description, Quantity.Quantity, Quantity.SeialNo, Quantity.SupplierID,...
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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
10267
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...
1
10040
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
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.