Questions tagged [textrenderer]
38 questions
8
votes
6 answers
TextRenderer.DrawText in Bitmap vs OnPaintBackground
If I use TextRenderer.DrawText() using the Graphics object provided in the OnPaintBackground my text looks perfect. If I create my own Bitmap and use the Graphics object obtained from my Bitmap my text looks terrible. It looks like it is…

Jon Tackabury
- 47,710
- 52
- 130
- 168
8
votes
2 answers
Text rendering still blurry : Best font for WPF application?
I know this is a very subjective question but as text rendering in WPF is still an issue I have to make the best out of it.
In WPF Application text tend to become blurry that is no secret. Also there are countless website about this topic and how…

TalkingCode
- 13,407
- 27
- 102
- 147
7
votes
2 answers
Why doesn't TextRenderer.MeasureText work properly?
I want to measure the height of the text given a certain width of available canvas. The text that I pass in is really long and I know will wrap. To that end, I call the following:
using System.Windows.Forms;
...
string text = "Really really long…

AngryHacker
- 59,598
- 102
- 325
- 594
6
votes
3 answers
TextRenderer.DrawText renders Arial differently on XP vs Vista
I have a c# application that does text rendering, something on par with a simple wysiwyg text editor.
I'm using TextRenderer.DrawText to render the text to the screen and GetTextExtentPoint32 to measure text so I can position different font…

Michael
- 61
- 2
5
votes
0 answers
TextRenderer.DrawText using GDI to render OTF Fonts?
I'm trying to draw text over a bitmap image and I've done some research and found that .NET/GDI+ doesn't support OTF fonts. I read somewhere that you could use TextRenderer.DrawText to render OTF fonts with GDI, but I can't seem to figure out how,…

Evan Layman
- 3,691
- 9
- 31
- 48
5
votes
5 answers
Accuracy of TextRenderer.MeasureText results
Calling TextRenderer.MeasureText as follows:
TextRenderer.MeasureText(myControl.Text, myControl.Font);
and comparing the result to the size of the control to check if text fits. The results are sometimes incorrect. Have observed the following two…

Aidan Ryan
- 11,389
- 13
- 54
- 86
4
votes
3 answers
Accurately measuring, rendering, hit testing and printing text in a WinForms application
We need to:
Measure text accurately.
Render text line by line to a screen graphics context in the presence of translation and scaling transforms applied to the graphics context.
Hit testing: allow text to be selected precisely with the mouse or via…

bright
- 4,700
- 1
- 34
- 59
3
votes
2 answers
How to wrap long word with TextRenderer DrawText in vb.net
How can I draw a long word on a form with word breaking using TextRenderer DrawText() in vb.net? I thought it's a simple question and I tried all TextFormatFlags combinations but I can't find nothing solution.
Can anyone help?
Here is a sample:…

Abigail La'Fay
- 749
- 1
- 9
- 18
3
votes
3 answers
Possible bug with Graphics.DrawString and TextRenderingHint in .Net Winforms
Here's the OnPaint method of a control that simply inherits from control and provides a property to get/set the textrenderinghint:
Private _mode as TextRenderingHint = SystemDefault.
Public Property Mode as TextRenderingHint
Get & Set _mode
…

Jules
- 4,319
- 3
- 44
- 72
3
votes
2 answers
TextRenderer.MeasureText() and textbox maximum text length
I have a long string (~100k characters). I need to know the length for this string. I call
Size s = TextRenderer.MeasureText(graphics, text, font);
But it returns width equals 7. Only if text length <= 43679 it returns correct value!
Also, if I…

Nikolay
- 587
- 6
- 20
2
votes
4 answers
LinkLabel needing more space than TextRenderer.MeasureText says
If I give TextRenderer.MeasureText some text to measure and width to use it will return the height needed to display that text.
private static int CalculateHeight(string text, Font font, int width)
{
Size size = TextRenderer.MeasureText(text,…

Mike Hall
- 1,151
- 2
- 10
- 24
2
votes
1 answer
Use DrawText to draw end of a text
Is TextRenderer.DrawText() capable to draw the end of a text when destination rectangle is too small?
TextFormatFlags.Bottom didn't helped me.
In others words: how to clip text on its top edge?

Velcro
- 546
- 1
- 8
- 27
2
votes
1 answer
TextRenderer.MeasureText return Width=0 for character "&"
All is in the title. I try to create my own OpenGL font system, and I need to get the size of each character I want to include in a Sprite texture.
All works well and accurately, except for the character "&" (ascii 38). Even if I change the font,…

Norris
- 31
- 2
2
votes
3 answers
Rotating text using Textrenderer
Hey, I'd like to display text in a 2D szenario using JOGL. But I can't figure out, how to rotate text using com.sun.opengl.util.j2d.TextRenderer. It does not have any methods concerning the rotation. So I was expecting the modelview matrix to have…

Querist
- 21
- 2
2
votes
0 answers
How is the LOGFONT quality value set for the TextRenderer
HELP!
I'm working on a C# web app where I am drawing on to a bit map. There are two ways to draw text:
1. Graphics.DrawString
2. TextRenderer.DrawText
According to the internet TextRenderer is the "newer way" but there are times where it looks worse…

Kealy Opelt
- 21
- 2