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
2
votes
2 answers

How to decrease font size to 0.0001f when using drawString()?

I have an assignment right now about OpenStreetMaps, where one of the exercises is to display the road names at their respective roads on the map. My problem right now, is that the coordinates we're using are so small, that even the smallest int…
zipfstein
  • 35
  • 1
  • 1
  • 5
2
votes
1 answer

Ugly rendering of image with DrawString-Method (ASP.NET)

I want to render some text as image in ASP.NET. It is working well, but the text is rendered very ugly (with grey pixels around the text) even if I turn on AntiAlias (or ClearType) by changing the graphics TextRenderingHint option. Here is the…
Raphael Müller
  • 971
  • 2
  • 8
  • 20
2
votes
1 answer

User Placed Text on a picturebox in c#

I am trying to make a tool that allows me to choose a certain location on a picturebox to put text from a textbox on. It will need to be able to place multiple different texts on the picturebox and then be able to be deleted. This is my current…
Chris Bacon
  • 995
  • 8
  • 30
  • 42
2
votes
1 answer

How do you use a drawString to repeat its character on multiple lines but then add another character as it goes down each line?

public class graphic { public static final int L = 10; public static void main(String[] args) { face(g,(L/2)*2, 20); } public static void face (Graphics g, int x, int y){ int e = (x+1)*10; int d = x*3; …
blam97
  • 31
  • 1
  • 6
2
votes
1 answer

Compact Framework: drawing multi-line string with ellipses

I'm creating an owner-drawn control inherited from ListView for a Windows Mobile application. I'm using Graphics.DrawString to write out a two-line text string (using .NET CF 3.5). Problem is some items have particularly long text that doesn't fit…
Michael Itzoe
  • 1,949
  • 4
  • 29
  • 49
2
votes
2 answers

C# Graphics.DrawString not rendering special characters?

I'm trying to write some arbitrary text to a custom control.My code works, but when I try to draw characters such as ü, it displays an empty square where the character would be.I need this to work as I intend to support localizations.I have checked…
Origamiguy
  • 1,294
  • 2
  • 13
  • 19
2
votes
1 answer

How to draw a string at an exact pixel position

I try to draw a string (single character) in C# into a Bitmap at an exact position with: Bitmap bmp = new Bitmap(64, 64); Graphics g = Graphics.FromImage(bmp); g.DrawString("W", font1, new SolidBrush(myColor), new Point(32,32); There is so much…
Konrad
  • 4,329
  • 10
  • 54
  • 88
2
votes
3 answers

Graphics.DrawString Not Rendering Code128A Font Like the Character Map

I am trying to use Code128A.ttf font to generate barcodes. I have been using the same font for years in Windows 2000 and 2003 with Delphi. However, when I try to use the font now with C# and .NET 4.5 in Windows 8.x, all of the text characters seem…
gridtrak
  • 731
  • 7
  • 20
2
votes
1 answer

DrawString with character wrapping

I'm creating a fatal error dialog for a Windows Mobile Application using C#. The problem is when I try to draw the stacktrace using DrawString, half of my stacktrace is getting clipped off because DrawString uses word wrapping instead of character…
Roy
  • 648
  • 9
  • 17
2
votes
1 answer

Put image with drawImage in java

I am a beginner Java programmer and I have a question for putting image in my java game. In my code, I am putting f but I want to change it with an image of a flag. How can I use drawImage? protected void paintComponent(Graphics graphics) { …
2
votes
2 answers

How to draw completely monocolor text with use of Graphics.DrawString?

Bitmap bmp = new Bitmap(300, 50); Graphics gfx = Graphics.FromImage(bmp); gfx.DrawString("Why I have black outer pixels?", new Font("Verdana", 14), new SolidBrush(Color.White), 0, 0); gfx.Dispose(); bmp.Save(Application.StartupPath +…
Kosmo零
  • 4,001
  • 9
  • 45
  • 88
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…
2
votes
0 answers

Write a word from a string in a different color using g.DrawString()

I use the function below to draw a string on an image. It words great for the most part when I draw a string using one color. However I want to have a word be in a different color. For example I want to draw "This is a TEST", I want TEST to be…
Kathy Judd
  • 715
  • 3
  • 9
  • 21
2
votes
1 answer

drawString with arabic characters-java

I am new to java grahics2D. I want to create it like where user can write as drawing or having keyboard buttons to draw the characters. I was looking over the internet and managed to do the paint section. I started testing the drawstring with Arabic…
OceanWavez
  • 291
  • 1
  • 2
  • 10
2
votes
1 answer

Can't print any string using drawString() in JFrame

I'm trying to find what is wrong with this short code. I can't print the String TEXT in my JFrame using drawString() method. Please Help . Only a plain white screen will appear if you run the program . Code: import javax.swing.*; import…
ZeroCool
  • 437
  • 1
  • 7
  • 23