How would I print text in a picturebox? In vb6 it is pic1.print (I believe). Thanks.
Printable View
How would I print text in a picturebox? In vb6 it is pic1.print (I believe). Thanks.
Do you want to print the contents of the picture box??? ;\
Here is an example if you do.
Code:private Image img;
private void button1_Click(object sender, System.EventArgs e)
{
img = pictureBox1.Image;
PrintDocument pr = new PrintDocument();
pr.PrintPage += new PrintPageEventHandler(this.PrintEX);
Margins margins = new Margins(0,0,0,0);
pr.DefaultPageSettings.Margins = margins;
pr.Print();
}
void PrintEX(object sender, PrintPageEventArgs ppea)
{
RectangleF rect;
rect = ppea.Graphics.VisibleClipBounds;
float width, height, scale;
width = img.Width;
height = img.Height;
scale = (float)((float)rect.Width / (float)width);
ppea.Graphics.DrawImage(img, 0,0, width * scale,height* scale);
}
No, I do not want to print the image in the PictureBox. I want to print "hello world" to the picture box. I want text in a picture box. I hope that is clearer. Thanks for your help.
oh ok. See if this helps.
http://www.dotnetforums.net/t74823.html
That looks like what I want. Can you convert that into C# :( Thanks for all of your help.