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
1 answer
Drawing A String onto a JPanel
I'm having a bit of trouble. I'm trying to draw a String (toString()) from a paint method (Graphics g), I have two main issues I believe:
1) When Repaint is called, it appears to not respond.
2) When I try to call from an obj. made in a constructor,…

user1411312
- 1
- 1
0
votes
1 answer
How to check in Java if a string isn't drawn over another string?
I am drawing some strings on a JPanel, but I dont want to these string to be drawn over each other.
How can I check if there is a string on a point on my panel?
Thanks!

Milan Bon
- 11
- 1
0
votes
1 answer
write a variable with drawstring()
I'm having some issues with the graphics in my program. I want to drawstring() to draw a variable on the screen, however, the variable is given from another class.
An 'outline' of what I have is this:
public void paint(Graphics g){
…

JamEngulfer
- 747
- 4
- 11
- 33
0
votes
2 answers
Improve image quality after draw string on it, in c#
I use Graphics.DrawString Method to write a text on image,
but the text quality become too low after saving image.
this id my code:
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("~/k32.jpg"));
Graphics graphicImage =…

El Ma
- 35
- 3
- 8
-1
votes
1 answer
How to use custom color in DrawString?
I want to use an RGB color instead of default color of C#, but I have no idea how.
e.Graphics.DrawString("Order Summary",
new Font("Roboto", 15, FontStyle.Bold),
Brushes.SteelBlue, new Point(350, 20));

xeyon
- 27
- 4
-1
votes
2 answers
Drawing string on image and save with same name C#
I'm working on a project where I have to draw text from front end using fabric.js. I have the code to send json for drawing string ie canvas.tojson().
On server side I have a problem in c#. I have to save the image with same filename. If I try to…

skhurams
- 2,133
- 7
- 45
- 82
-1
votes
1 answer
Drawstring overlapping each other?
CodeA:
Image imageChipsetName = new System.Drawing.Bitmap(photoWidth, photoHeight);
StringFormat strFormat = new StringFormat();
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
Graphics graphics =…

SuicideSheep
- 5,260
- 19
- 64
- 117
-1
votes
2 answers
Unable to add my second JPanel to my JFrame?
For some reason I am unable to add my secondary JPanel under the first one that I have. I am able to add the first JPanel with no errors, however when I try to add the second JPanel in the same way it does not work, and gives me a multitude of…

user1234
- 17
- 4
-1
votes
1 answer
drawString() text acting glitchy in my GUI program
I'm having an issue with a class project that I'm currently working on. Basically, we are creating a GUI where you select the style of text you want after typing in something in a JTextArea. Once you hit a display button, it should display the…

Alex
- 2,145
- 6
- 36
- 72
-1
votes
1 answer
Save Draw String or e.graphic as image
NEED HELP PLEASE ! Saving Picture with ""Drawstring, e.graphic""
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim Bmp As New Bitmap(Width, Height)
Dim objBitmap As New Bitmap(Width, Height)
…

Nazim Iqbal
- 21
- 1
- 4
-1
votes
1 answer
How to draw string so it is not overlay old one
I am drawing some signs in my JPanel(hh:mm -> time), but when I update it and call repaint it covers old letters(they don't dissapear). How to fix this?

Yoda
- 17,363
- 67
- 204
- 344
-1
votes
1 answer
Drawstring refuses to stay on screen (XNA)
been fighting with this problem for a good 3 hours now, and i figured it was finally time to ask some professionals.
My problem is that i want to make a scrollbar, and I've figured out that i want to make it by using two integers and then give every…

Etarnalazure
- 200
- 1
- 2
- 14
-3
votes
2 answers
C# and XNA display more than one text
I want to show more than one text with the C# and XNA. The situation is like this. If A then display AAAAA; If B after 'A' then display BBBB and AAAA at the same time.
Here is the code I wrote:
if (Score == A)
{
spriteBatch.DrawString(
…

user3684119
- 63
- 7