In C# how to print an image shown in the picture box with the actual dimensions of the picture not the dimensions of the PictureBox? Here I have this code that I use to print the image, but it is printed according to the height and width of the PictureBox and not the height and width of the original image:
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(Pbox.Image, new Rectangle(0, 0, Pbox.Width, Pbox.Height));
}
If you want to print the actual dimensions of the image, you can use the PhysicalDimension
image.
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(Pbox.Image, new Rectangle(0, 0, (int)Pbox.Image.PhysicalDimension.Width, (int)Pbox.Image.PhysicalDimension.Height));
}