J
Jeff
hey
asp.net 2.0
Below you see my code.
#1
How to place the text at the buttom right of the image? I mean how do I
calculate the x,y parameter of the DrawString method?
#2
How can I place the text vertically centered in the image. Also here I mean
how do calculate the x,y parameters of DrawString
MemoryStream ms = new MemoryStream(test.FileBytes);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
Bitmap img = new Bitmap(new Bitmap(image));
Debug.WriteLine("Height = " + img.Height.ToString());
Font font = new Font("Verdana", 12);
Graphics gfx = Graphics.FromImage(img);
gfx.DrawString("Hello World", font, Brushes.Black, 5, img.Height - 12);
img.Save(Response.OutputStream, ImageFormat.Gif);
(as you see in my code, I'm using font size 12. Then I thought it was a good
idea to subtract 12 from the height. But that didn't solve the problem -
half of the text was drawn below the image)
any suggestions?
asp.net 2.0
Below you see my code.
#1
How to place the text at the buttom right of the image? I mean how do I
calculate the x,y parameter of the DrawString method?
#2
How can I place the text vertically centered in the image. Also here I mean
how do calculate the x,y parameters of DrawString
MemoryStream ms = new MemoryStream(test.FileBytes);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
Bitmap img = new Bitmap(new Bitmap(image));
Debug.WriteLine("Height = " + img.Height.ToString());
Font font = new Font("Verdana", 12);
Graphics gfx = Graphics.FromImage(img);
gfx.DrawString("Hello World", font, Brushes.Black, 5, img.Height - 12);
img.Save(Response.OutputStream, ImageFormat.Gif);
(as you see in my code, I'm using font size 12. Then I thought it was a good
idea to subtract 12 from the height. But that didn't solve the problem -
half of the text was drawn below the image)
any suggestions?