473,804 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 TextRenderingHi nt 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(PaintEv entArgs e)
{
base.OnPaint(e) ;
Font font = new Font("Tahoma", 12.0f, FontStyle.Regul ar);

e.Graphics.Text RenderingHint = TextRenderingHi nt.AntiAlias;
TextRenderer.Dr awText(e.Graphi cs, "Antialiase d Text", font, new Point(0,
20), Color.Black);

e.Graphics.Text RenderingHint = TextRenderingHi nt.AntiAliasGri dFit;
TextRenderer.Dr awText(e.Graphi cs, "Antialiase d Text", font, new Point(0,
40), Color.Black);

e.Graphics.Text RenderingHint = TextRenderingHi nt.ClearTypeGri dFit;
TextRenderer.Dr awText(e.Graphi cs, "Antialiase d Text", font, new Point(0,
60), Color.Black);
}
Jun 18 '07 #1
1 2057
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
2516
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 hard time to understand vb syntax. I don't know if anyone in here can point out which is the equivalent object used in c sharp. Translate these two lines to C sharp: Sub Next_Click(Sender As Object, e As EventArgs) Select Case...
2
1225
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 figure out how wide/tall text label would need to be to handle the text? TIA - Jeff.
2
1969
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 good. Then when I call drawstring and pass the rectangle I get via Region.GetBounds(Graphics) it draws it with the same offset as the beginning of the label. Not good.
3
1650
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 good. Then when I call drawstring and pass the rectangle I get via Region.GetBounds(Graphics) it draws it with the same offset as the beginning of the label. Not good.
6
6626
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 pixels! i.e., what's the height of the mentioned text when it's being automatically word wrapped within a rectangle of WIDTH pixels? How am I supposed to calculate the height required to show the message? TIA, Mehdi
17
4761
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 scroll... eg Override OnPain and OnPaintBackground Override WndProc
6
3738
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 Inherits Windows.Forms.ToolStripProfessionalRenderer Protected Overrides Sub OnRenderItemText(ByVal e As System.Windows.Forms.ToolStripItemTextRenderEventArgs) If (Not e.Item.Enabled) Then e.TextColor = Color.Red
1
4377
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 does not equal width2. Since it's a monospace font, why not? That's the question boiled down to its essence. The background is this: I'm trying to display a tooltip based on the character the mouse is hovering over in a DataGridView. For...
1
4230
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 anyone knew a way to tell if it *has* truncated an item in a column for this reason? (I want to widen the form it sits on as much as necessary to fit everything in without truncating, if possible, and if the user wants that behaviour.) The...
0
9716
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
9595
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
10604
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
10354
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
10359
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,...
1
7643
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
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.