Can I specify line space in GDI+


A

Anton

hi

asp.net 3.5

I'm trying to draw onto a webpage using GDI+, I want to draw several lines,
the problem is in finding the correct line space when using different
font-size on each line... hope someone here can help with this on

I have this code:
Image imageFile;
imageFile = Image.FromFile(Server.MapPath("~/Images/blank_600x65.jpg"));

Graphics newGraphics = Graphics.FromImage(imageFile);
Pen pen = new Pen(Color.Black);

newGraphics.DrawString(info, drawFont, drawBrush, new PointF(0, y));

if (size == 4)
y += 13;
else if (size == 5)
y += 15;
else if (size == 5)
y += 17;
else
y += 13;

The problem is that I want to draw several lines (max 7 lines) of text, and
I need to calculate the line spacing, as it's now it's not done correctly,
the user can select different font-size and then the if test for y don't
produce the correct value. As of now in my code: if user draws line #1 in
font-size 10, and the line #2 comes too close to line #1...

I need a way to calculatet what line spacing I need...

any ideas?
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top