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
2 answers
How do I write rows and columns with drawString in Java
public void drawboard(Graphics g){
g.setColor(Color.yellow);
for (int row = 0; row < board.length; row++){
for (int col = 0; col < board[row].length; col++){
g.drawString("X", col, row);
}
}
All I get…

johnny
- 19,272
- 52
- 157
- 259
0
votes
1 answer
DrawText doesn't work, but Graphics::DrawString is ok
I am creating a bitmap in the memory which combine with an image and text. My code is:
HDC hdcWindow = GetDC();
HDC hdcMemDC = CreateCompatibleDC(hdcWindow);
HBITMAP hbmDrag = NULL;
if (!hdcMemDC) {
ReleaseDC(hdcWindow);
return NULL;
}
RECT…

yw5643
- 189
- 1
- 12
0
votes
1 answer
Get graphics object that is drawn by Graphics.DrawString(..) method?
I am working on a project where I need my drawn animation with letter on the form - and check when falling letter reaches a certain position.
The thing is that I would like to use the method IntersectsWith but can not do that since the DrawString()…

EugenSunic
- 13,162
- 13
- 64
- 86
0
votes
1 answer
DrawString without trimming
How can I use the DrawString function and send it a rectangle (to set the alignment)? If the text is longer from the rectangle's width then the line will continue until the end of the line?
(not multi line case!!)

Shiran
- 9
- 1
0
votes
2 answers
Class - Graphics - drawString()
I'm trying to display a message in a JPanel.
I've used the drawString() function of the Graphics class.
Here's my code :
public class Frame {
JFrame frame;
JPanel panel;
Graphics graph;
Frame() {
frame = new JFrame();
…

mathieu_b
- 383
- 1
- 5
- 19
0
votes
1 answer
C#.Net Graphics Object Drawing on Two Images and Not One as Intended
I'm trying to draw a string on an image and display it on a picturebox and I'm using the DrawString function in the .Net graphics library.
Problem is the function is drawing on two images - (the image that I want it to draw on, and the original…

Alazubbu
- 13
- 1
0
votes
2 answers
Embedding TTF and using with g2d
I'm trying to embed a TTF font and then use draw it with Grapics2D. I've been able to create the font, but I'm not exactly sure how to pass the font to setFont. I make a new font here, which throws no exceptions:
private Font pixel =…

user2720349
- 35
- 2
- 4
0
votes
1 answer
Drawing a String on C# webpage
I want to know how do I create an Engraving function like on this website?
http://www.bluenile.com/product_engraving?engrave_action=add_to_existing_item&is_ring=1&lineID=47017522&oid=20375&ring_size=7
I have already googled about it, it seems like…

avdnowhere
- 177
- 2
- 16
0
votes
1 answer
Bitmap graphics: when saving on disk no drawed strings - works when memorystream
I am creating a PNG picture, using the Bitmap object, using Drawing.Graphics . I create a Bitmap, insert a background image and draw some strings.
Now, when I save the image on the disk, the files does not have my strings!
I am doing this in ASP.NET…

Lars Holdgaard
- 9,496
- 26
- 102
- 182
0
votes
2 answers
Java drawString parallel to a line
How to draw string in java parallel to a line when I know line coordinates?
Below is my code so far, x1,y1 and x2,y2 represents the coordinates of line.
(text has to be parallel and to the center of the line)
g.drawLine(x1, y1, x2,…

sanjan
- 147
- 1
- 2
- 6
0
votes
1 answer
Drawing text on envelope
Hy guys!
I need a little assist on this because I cant really figure it out what I'm doing wrong. I'm working on an envelope writing program. The program have 4 JTextField.
Name, City, Addres, Postal Code. I use keylistener on Name JTextField to…

Gabor Beke
- 7
- 4
0
votes
2 answers
Simplest Gui Test Java repaint
It's a simple question, maybe I just don't understand the tutorial I'm reading from. but I've been stuck on this for a while. My program is as simple as it gets aside from a "hello world". What I'm trying to do is this: when the user clicks the…

Joel Ye
- 63
- 1
- 4
0
votes
1 answer
How can I navigate to a windows generated control?
I have this code
private void picturebox1_Paint(object sender, PaintEventArgs e)
{
if (Percent == 100)
{
e.Graphics.DrawString("Completed!", font, Brushes.Black, new Point(3, 2));
}
}
And I want to…

Emalton
- 5
- 3
0
votes
1 answer
C# Position font in middle of rectangle with the biggest fitting size
I'm trying to generate a font-map using C#'s Graphics class.
The characters are supposed to be perfectly in the middle of their rectangle in order to use them afterwards. Secondly, I want to use the biggest font-size with all characters fitting…

Jan Berktold
- 976
- 1
- 11
- 33
0
votes
3 answers
Label inside Circle
I want to put text ( must be formatted with HTML, so I can't use drawString in PaintComponent) inside Circle. Problem is that "paintComponent" is called after drawing label, so it covers my text.
How to draw oval at the beginning and then draw my…

user2262230
- 199
- 1
- 3
- 17