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

Difference between html font size and c# DrawString font

I am trying to do the following: user uses some html page where he can upload images and also add text. This is the app for apparel company. So basically we have a t-shirt background picture and we place some image and text over it. Then in the back…
Giorgi Nakeuri
  • 35,155
  • 8
  • 47
  • 75
1
vote
1 answer

Smallcaps / multiple fonts and bolding using 'DrawString' in GDI+

I want to write out some text using smallcaps in combination with different fonts for different words. To clarify I might want the message 'Welcome to our New Website' which is generated into a PNG file for the header of a page. The text will be…
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
1
vote
3 answers

Display many text in same windows java

I want to display many text in the same windows but only the last text is displayed, there is my 2 class : import Test.Graph; import javax.swing.JFrame; public class InterfaceGraphique extends JFrame { private static final long…
Yatsu
  • 9
  • 2
1
vote
1 answer

How to draw a right-aligned string which does not fit completely in surrounding rectangle

Rectangle Location = new Rectangle(X , Y, W, H); var TextFormat = new StringFormat() { Alignment = StringAlignment.Far }; string Text = "RRRR1234567890123456789012345678901234567890RRRR"; e.Cache.DrawString(Tekst,_Font,_Brush, Location,…
1
vote
2 answers

Popping up a TextBox on mouse click over a PictureBox for adding custom note to picture

In my C# winforms application, I have a picturebox which some bitmap images can be loaded into it. What I want to do is if user clicks somewhere within picturebox, at the mouse location a small textbox will be appeared and user can add a custom text…
Dumbo
  • 13,555
  • 54
  • 184
  • 288
1
vote
2 answers

GDI+: Draw underlined space with DrawString

Hallo, i want to draw a justified text in GDI+. When this text is underlined I have a problem, with the DrawString method: - If you give to this method a string with a whitespace and the format underlined, it draws nothing, because the space has no…
Sperl Christoph
  • 73
  • 1
  • 1
  • 6
1
vote
1 answer

How can I draw multi-colored text using graphics class on panel?

I want to draw the following text on panel: It is a multi-colored text. I found this article about drawing multicolored text. I replaced characters with words but it doesn't work. (I use FillPath/DrawPath to draw text) my code: private void…
Rasool g
  • 11
  • 1
  • 4
1
vote
0 answers

Java g.drawString() calls causing very slow initialisation

The following code typically gives an output of around 1500-2000ms, which is far too long to simply draw a string in a JFrame. public static void main(String[] args) { CustomFrame frame = new CustomFrame(); frame.setVisible(true); } class…
max batten
  • 11
  • 1
1
vote
0 answers

Really center text vertically in C# with DrawString

I need to draw a string in a panel perfectly centered, horizontally and vertically. Centering horizontally is not a big deal using the MeasureString function. Bug, the MeasureString function returns a height that takes care of every possible char…
Sierramike
  • 371
  • 4
  • 16
1
vote
1 answer

DrawString with highlighted text in my asp net program using mvc

i'm making a web app which writes text on a series of images.Now the text must be highlighted Yellow. I'm using DrawString , but with it i cannot make this operation. My code is: g.DrawString( text...", fontSize, fontColor, 200, 320,…
1
vote
0 answers

DrawString and TextBox same rendering

Inside OnPaint of a form I am rendering some text on top of an image. For that I call Graphics.DrawString with word wrapping enabled. In order to be able to edit the text I occasionally show (and hide again after editing) an additional TextBox…
oliver
  • 2,771
  • 15
  • 32
1
vote
0 answers

C# UserControl Draw outside of TableLayoutPanel cell

C# .Net 4.5 Winform On my Form, I have a SplitContainer, and in the right panel, my custom UserControl with a TableLayoutPanel. As I draw UserControl items in each cell of the TableLayoutPanel, I want to use DrawString to display text on the…
Robert Achmann
  • 1,986
  • 3
  • 40
  • 66
1
vote
2 answers

How do I draw double height text using Graphics.DrawString?

I am trying to emulate a POS printer with System.Drawing and one of the functions I need is to draw text at double height. Any idea how I can do this using .Net's Graphics class? Do I need to draw the text twice as large and condense it or draw…
Alex
  • 242
  • 1
  • 9
1
vote
1 answer

Layering graphics with transparency

Just making a little game and want to layer my pause menu over top. A timer is responsible for the game loop. When it's paused, it calls a separate function that draws the pause menu. Right now I am drawing a small centred rectangle. The rectangle…
MattyMatt
  • 531
  • 5
  • 21
1
vote
3 answers

Java Graphics2D scale font to fill in background

I'm having troubles scaling font to fit in background width. I have a 1000 height and 350 width background, and I'm trying to scale font when it's bigger than background. I've done several test with different font and results are the same, some…
SheenStvz
  • 11
  • 1
  • 3