Help Needed!!!

  • Thread starter Thread starter Stone Chen
  • Start date Start date
S

Stone Chen

Hello,

I need to format a string onto a image to produce a dynmaic text image with
a specific line spacing, but unable to find the proper method in C# to do
so. MSDN says that stringFormat deals with line spacing, but does not give
any specific on how, and the getHeight method of Font produces the line
height, but what I need is a way to set it. Any help would be much
appreciated.

PS. I used the code from Jeremy Rule for this, his code is available at

http://weblogs.asp.net/jrule/archive/2004/08/16/215393.aspx


Thanks
 
Stone,

To set the bitmap is this used in the code
// get a rectangle on his shirt
30 Rectangle rect = new Rectangle(150, 216, 210, 135);

You never can set a height of a font. However you can set a fontsize what is
done in my opinion in this row of the code.

path.AddString(text, font.FontFamily, (int) font.Style, font.Size, rect,
format);

I hope this helps?

Cor
 
Stone,

To set the bitmap is this used in the code
// get a rectangle on his shirt
30 Rectangle rect = new Rectangle(150, 216, 210, 135);

You never can set a height of a font. However you can set a fontsize
what is done in my opinion in this row of the code.

path.AddString(text, font.FontFamily, (int) font.Style, font.Size,
rect, format);

I hope this helps?

Cor

Thank you for your promoptly reply, but I really cannot reset the font
size, as the art department will have my head. I still need a solution
for multi-line line spacing, and splitting each lines into smaller
rectangles is not a solution.

Thanks again.
 
Stone,

Did you try
Font font = new Font("Times New Roman", 16, FontStyle.Regular);

Did you try that one in advance?

Cor
 
Hi Stone,

It's been MANY years since I've done this, so my memory of drawing words on
an image are a bit rusty, but if I remember
right, you will have to handle the word wrap yourself since you are drawing
the words on the image.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
Back
Top