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
1 answer

C#: Using drawstring to annotate images works but not able to get text in bottom left corner, only bottom right

I'm making a batch watermarking tool for myself and some others at work and using the following code allows me to annotate text on the bottom right of the image but I'm not able to make it annotate on the bottom left without manually adjusting the…
Saintjah
  • 153
  • 3
  • 12
0
votes
1 answer

Displaying Strings on frame with drawString?

So my program is like this, I click a part of the frame and a JOptionPane comes out, asking for input. For example, I type in APPLES. Then, I click on another part of the frame, this time typing in ORANGES. Here's the catch. When I hover over the…
alicedimarco
  • 325
  • 1
  • 5
  • 20
0
votes
2 answers

Preventing Color Bleed when using Graphics.Drawstring()?

How do I prevent colors form bleeding into one another when using the vb .net Graphics.Drawstring method. This Occurs with colors that really shouldnt be used together eg green/orange and black and red. Thanks
keyoke
  • 1,209
  • 12
  • 26
0
votes
2 answers

Strange behavior from a Java Graphics drawString call in a loop

I'm at a complete loss here. I have a method that goes through a Vector of TreePaths containing a custom FileNode class, and extracts the File contained in each last node. The result is a printed list of all the filenames in the Vector. I had a for…
SaintWacko
  • 854
  • 3
  • 14
  • 35
0
votes
1 answer

Drawing a string with full justified in .NET

I need to sraw a string to a bitmap with full justified. I know that StringFormat.Alignment doesn't support full justified alignment. So, I'm looking for a solution to draw a string on a bitmap with full-justify. RictTextBox has full justify but I…
oruchreis
  • 866
  • 2
  • 12
  • 28
0
votes
1 answer

Is it possible to make the string drawn on screen stable while moving the mouse cursor (using C#)?

I'm trying to draw a string on the screen (attached to the mouse cursor) using C#, and the string value and its location change with the mouse movement. The problem here is when hovering the mouse, the string is drawn multiple times in multiple…
0
votes
0 answers

When drawing characters with Graphics in C# or Java, set only the left and right lengths

I currently need to convert Datamax's DPL commands to create previews. Currently, it seems that there is no java or C# library that can convert DPL commands into images, so I am trying to express it by drawing it with Graphics. (What I do on the…
suho.kim
  • 1
  • 1
0
votes
1 answer

When I try to place a string using pictureBox with a transparent background, I get ugly white pixels around my string. How to solve this problem?

I removed backColor from the form and added a pictureBox. After that I'm trying to draw a string. But It looks really ugly with these white pixels. Could y'all help me, please? Here is a screenshot of the…
Corpus
  • 31
  • 4
0
votes
1 answer

I want to use custom font in Flutter Image.drawString

This is about Flutter, Dart, Image, specifically drawString function. First of all, what I am trying to do is watermark the picture taken with the address and time. I mean not just placing text over the image but actually merge it with picture so…
0
votes
1 answer

Drawing with drawString doesn't look good

The result of drawString with the same font and size in java The appearance is different when drawn with the same font and size in a painter (or word). Drawing with drawstring in java doesn't look good. Why does it look so different? Is there a way…
0
votes
1 answer

How to owner draw a TreeView Node to show two lines of text

I am trying to figure out a way to use the StringFormat class to add new line to a given TreeNode text. For example, the string ID1:123456, ID2:789000, can be split by comma and insert a newline in between, so it has two lines. I understand there is…
Emory Lu
  • 77
  • 1
  • 9
0
votes
1 answer

.NET DrawString() different text layout when changing graphics scale

I'm using simple code to draw text inside specified rectangle. Everything works fine, except that sometimes text layout is different depending on graphics scale (set via Graphics.ScaleTransform method). It's hard to describe the issue in words, so…
SiliconMind
  • 2,185
  • 4
  • 25
  • 49
0
votes
0 answers

VB.NET WinForms: DrawString does not center, despite using Stringformat.Center

I'm trying to draw my text in the center of my (test) rectangle. my (simplified) code: Sub Main() Using x As New Form1() x.ShowDialog() End Using End Sub Imports System.Drawing Imports System.Windows.Forms Public Class Form1 …
Eviler
  • 39
  • 6
0
votes
0 answers

GDI changes my Font to MS Sans Serif, if code is executed in Non-UI-Application

I have a method which generates images using DrawString(). If I call this method on every machine I tested from any program with an UI or from Console-App every thing is fine. The image shows the right font. But if I call this method from windows…
0
votes
1 answer

String won't display using drawString()

I'm writing a simple Trivia game and I ran into a problem where the question string won't display In my frame I'm using border layout with "new game" and "end game" on the bottom (South) and my Trivia panel in the center. The Trivia panel is made of…
Elad Nadav
  • 27
  • 6