Graphics.DrawString is a method in the .Net Framework's System.Drawing namespace, by which code can draw text onto an image in .Net code. This is mainly used in ASP.Net, as TextRenderer.DrawText (from System.Windows.Forms) provides more reliable functionality in Windows Forms applications.
Questions tagged [drawstring]
313 questions
0
votes
0 answers
Java Swing and .drawString - Can you right justify text with drawString?
I have looked around the site and did not find the answer to my question. So any help is appreciated.
I want to use drawString to write individual text strings that each end at the same distance from a point that is the center of a circle. The…
0
votes
1 answer
Drawing text on image not working with Graphics2D
I am running into some issues while wanting to write some text on an image.
As I looked, it could be done with following code:
package asd;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import…

slomil
- 193
- 1
- 4
- 12
0
votes
2 answers
My drawString won't work
Im somewhat new in java, been programming for about a year now and im currently working on a project that lets the user choose a map (worldmap for example) and add cities to that map by clicking the map.
When the user clicks on the map he/she…

John Snow
- 5,214
- 4
- 37
- 44
0
votes
3 answers
Draw and Clear String over a Control C#
After some search at Google I had some examples but none of them gave me what I need.
I need to write a String (WriteString()) into a Control in WinForm on a ButtonClick and I need to update that Draw, because i'm trying to write the Date into the…

Rosmarine Popcorn
- 10,761
- 11
- 59
- 89
0
votes
0 answers
VB.net, What's the best way to display text on screen, OUTSIDE of main form, and remains visible even when form is minimized?
To give an example of what I mean, external FPS counters, that overlay the entire screen or overlay a certain window, it allows for users to click through it, stays visible, and doesn't have a main form window that's visible.
Now using visual studio…

user6471847
- 3
- 2
0
votes
1 answer
Poor performance with drawString from Graphics library
I'm making a 2D card game. In it I have a custom font uses drawString from the Graphics library to draw it in with custom color and size. Problem is that this seems incredibly unoptimized. I can't seem to find out why. With 5 cards on screen, each…

GooseWithDaGibus
- 11
- 4
0
votes
0 answers
How to render fixed width text onto an image with c#?
I'm attempting to convert a text file to an image using a certain font (Courier New). The problem I'm having is that the font is fixed width, but the text is not being rendered that way on the image. Here's the code I'm currently using
var…

juharr
- 31,741
- 4
- 58
- 93
0
votes
1 answer
Windows Forms Dynamically Sizing Text to Fit a Rectangle
Using Windows forms, I have a rectangle in which I want to paint some text inside using Graphics.DrawString. What I want to do though, is create the font as large as possible, whilst keeping the text within the bounds of the rectangle and only…

Bryan
- 3,224
- 9
- 41
- 58
0
votes
0 answers
How to make DrawString work for negative y scale factor?
Working on a private stock chart where I use a rendering rectangle with an origin at lower left and inverted y axis, scale factor y is negative. Y axis ticks render nicely but drawing text (drawstring) is where I run into problems.
using…

user3351749
- 21
- 3
0
votes
1 answer
WPF Write Text to Image and send to Printer
i want to create a little image containing a logo and multiple lines of text and send it directly to a printer. However im having trouble with textquality.
Currently im creating a Bitmap and render text to it via g.DrawString:
Bitmap bitmap = new…

madman
- 1
- 3
0
votes
1 answer
How to draw any text using drawString() in Java
I'm getting into graphical stuff in Java and want to display text. As I've read, drawString() is the standard method for this. My code to draw the string is:
import java.awt.*;
import javax.swing.*;
public class TextDisplay extends JPanel{
…

LukasFun
- 171
- 1
- 4
- 17
0
votes
0 answers
PrintDocument baseline printing and line spacing
I have an app that prints very small labels.
One thing I have noticed is that the printing (using DrawString with a rectangle) aligns text based on the TOP of the font ascender size. So when there are 2 font sizes on a line, you get this.
The…

Some_Yahoo
- 509
- 6
- 9
0
votes
1 answer
How can I print a text file with tabs in it?
I am trying to print a text file with tab characters in it. The problem is that these tabs are not shown when printing. Here is my code:
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim linesPerPage As Single…

serializer
- 1,003
- 2
- 13
- 27
0
votes
1 answer
Graphis.DrawString always uses the default font
I have a project in which I create an image with rotated text around an invisible circle.
The drawing in itself is working just fine. However, it seems that no matter the font I use, I always get the same result, which is I assume some low quality…

David Brunelle
- 6,528
- 11
- 64
- 104
0
votes
0 answers
DrawString Quality Different Between PictureBox and Bitmap
I needed to write text left-to-right but each character rotated 90 degrees counter clock wise so that on a print out it would look like the text is written vertically top-to-bottom like this:
To achieve this I've created a temporary Bitmap with the…

Adam Crowe
- 39
- 5