Questions tagged [drawstring]

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.

313 questions
0
votes
2 answers

What is the correct syntax for changing fonts and drawing strings in Java?

Can someone check my syntax here? I am passing "Times New Roman","Arial","Verdana" to fontName and using 8,12,15 etc. for fontSize. It never changes the font here. I am doing this to write some text over an image. Graphics2D g2d = (Graphics2D)…
Pit Digger
  • 9,618
  • 23
  • 78
  • 122
0
votes
1 answer

How to prevent "drawstring" from being removed?

private void Side_pictureBox_Paint(object sender, PaintEventArgs e) { if (doubleclicked == true) { Side_pictureBox.Refresh(); for (int numbering_for_digram = 1;…
0
votes
1 answer

How can I change the direction text flows in a drawstring?

I'm making a label printing thing for a candy shop in C#. The label printer stock is narrow and tall, like a portrait style format so I'm printing using System.Drawing.StringFormat drawFormat = new…
Doug Matthews
  • 41
  • 1
  • 8
0
votes
0 answers

Add Google font on DrawString in a rectangle over an image

i got a request to change the Font family of a string that im drawing on a rectangle and after in an image , my question is : How? , i know how to add a custom font on the html but this time im assigning it by code behind like this : …
0
votes
0 answers

GdipDrawString not properly displaying text

I'm new to GDI+ and am trying to modify a program so that it draws a black rectangle over a specified object and then display text describing what the covered object is. I've been able to get the black rectangle to display but have gotten very stuck…
0
votes
1 answer

Printing on the x-axis: start position not exact - is there a value/function for the x-axis?

I have got an issue with e.Graphics.DrawString(TextToPrint, Font, Brush, New RectangleF(StartPositionX, StartPositionY, Width, Height)) Let's say I want to print "Hello World" in Arial-20pt at 25mm on the x-axis from the left edge. In addition, I…
0
votes
1 answer

Can't get rectangle to show up on the bottom of the image

I'm currently trying to draw a black rectangle over an image, but it just wont go to the bottom of the image. If I try to push it down, it just fills the image with the black rectangle. Here's my code: public void AddTextToImage(string LabelText,…
Joel R
  • 79
  • 8
0
votes
1 answer

Margin in VB.NET printing

I am trying to print a receipt on 58mm thermal printing with the use of vb.net and Graphics.DrawString of vb.net but it is leaving some space at the beginning. I have also tried by giving the x coordinates values as 0 and negative, in such cases the…
Bhaumik Vyas
  • 55
  • 10
0
votes
0 answers

Draw a multiline text in an image in Asp.Net MVC

I am trying to draw a text in an image, but the problem is that when the text is long it goes out of the image. I need to define a limit to break the text in to or more lines. Can you help me? Thanks! screenshot string text = "This is an…
0
votes
2 answers

JTextArea Printing

I have an JTextArea with some lines of text in it.I want to print that lines of text, here i am using the method getText() and storing the whole data into a string variable. I am passing that string to the print class. while printing that string,…
upendra
  • 1
  • 3
0
votes
0 answers

GDI+ DrawingString following a path for RAD Delphi

May you help me to use GDI+ (in RAD Delphi) to use a command as such: Graphics.DrawString('text',-1,font,MakePoint(x,y),Brush) following a path. In fact, I want to put a string text around a circle following the circus radius. I didn't succeeded to…
0
votes
1 answer

What is the way to draw a string with all characters equally wide in terms of pixels?

Bitmap bmpChar = new Bitmap(16,16); FontFamily fontFamily = new FontFamily("Arial"); Font font = new Font( fontFamily, 16, FontStyle.Regular, GraphicsUnit.Pixel); Graphics…
huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97
0
votes
0 answers

Re-Order C# Graphics Output

I am using C# to write data to a print page, and the data is outputting in the incorrect order. I need to change the order so that it will display as 1, 4, 2, 3 and not in 1, 2, 3, 4 This is my current syntax: //Section 1 int iAreaStartLX =…
0
votes
2 answers

Setting drawString so (0,0) is inside the draw area

I have a problem which I for the life of me I cannot figure out. I ask for user input and then it makes a JFrame and shows the word. I want to display the word at (0,0) but this appears to be out of the field, and writing up in the top where the…
Abraxas
  • 11
  • 4
0
votes
0 answers

C#, how to Draw string on Image inside a rectangle and determine font size according to image size?

i need a solution to draw string on an image inside of a rectangle and setting the font size according to the image size (resolution)? SAMPLE IMAGE as you can see i need to put some text (right-to-left text) inside of that blue rectangle with font…
Khaled Rakhisi
  • 317
  • 1
  • 4
  • 18