473,408 Members | 1,951 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,408 software developers and data experts.

No apparent equivalent to antialised text when using TextRenderer

I have been unable to draw antialiased text using TextRenderer (although
ClearType works just fine, we still need regular antialiased type in some
places). Is there a way to generate antialised text using TextRenderer other
than setting the TextRenderingHint on the DC in the Graphics parameter?

Thanks in advance for any answers or suggestions.

Josh Usovsky

In the following code snippet, the first two lines of text are rendered with
the single bit per pixel rendering hint:

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Font font = new Font("Tahoma", 12.0f, FontStyle.Regular);

e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
20), Color.Black);

e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
40), Color.Black);

e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
60), Color.Black);
}
Jun 18 '07 #1
1 2038
Aren't MSDN Universal members supposed to receive an answer from MSDN staff
for this question within 48 hours?
Jun 21 '07 #2

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

Similar topics

4
by: Hai Nguyen | last post by:
I'm learning C sharp and do not like vb much. I'm creatiing a wepage using panel to test myself. I tried to use these code below, which is written in VB, and to transform them to c sharp but I got...
2
by: UJ | last post by:
I have a small window that contains some text. I want to make the window as small as possible but still be able to hold all of the text ( the text changes over time ). Is there any way I can...
2
by: John B | last post by:
I need to create a label with the last character drawn in red. My idea was to create a label and override OnPaint. So far so good. I then measure the character range for the last character. All...
3
by: John B | last post by:
I need to create a label with the last character drawn in red. My idea was to create a label and override OnPaint. So far so good. I then measure the character range for the last character. All...
6
by: mehdi_mousavi | last post by:
Hi folks, Consider a text containing 200 characters (more or less) including and/or excluding the CR/LF within. I would like to compute the height of this text whenever it's width is limited by X...
17
by: pigeonrandle | last post by:
Hi, I have seen loads of different ways to do this, but the all seem to yield the same result - text that doesn't flicker when it's moving too slowly! Does anyone know 'the best way' to make text...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to specify a custom color for disabled text that is used by a class that inherits from ToolStripProfessionalRenderer. The code would look something like this: Public Class MyRenderer...
1
by: dvestal | last post by:
Font font = new Font("Courier New", 8); Graphics g = listBox1.CreateGraphics(); int width1 = g.MeasureString(" ", font).Width; // a space int width2 = g.MeasureString("S", font).Width; width1...
1
by: JTeagle | last post by:
I have a list view control which, when too narrow widthways, truncates the items automatically with '...'. This is exactly how I want it to behave when it's not wide enough, but I wondered if...
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...
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,...
0
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...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.