Hello
I have two pictureboxes and I want them to be placed 5 millimeters away from each other. How can I do that?
Thanks :)
Printable View
Hello
I have two pictureboxes and I want them to be placed 5 millimeters away from each other. How can I do that?
Thanks :)
How you define 5mm on a Form? Or are you talking about a printed page?
On a printed page.
If you're talking about on a form on screen then you'd have to consider the DPI of the monitor, but what if someone has multiple monitors at different DPIs? What if they move the form between those monitors? What if the form straddles two monitors? What if the user changes the resolution?
I meant, when printed, the two pictureboxes should be 5 mm apa
Let's assume only one computer will be used.Quote:
If you're talking about on a form on screen then you'd have to consider the DPI of the monitor, but what if someone has multiple monitors at different DPIs? What if they move the form between those monitors? What if the form straddles two monitors? What if the user changes the resolution?
But that's the point I was making: you're not printing PictureBoxes, you're printing Images. Your original question should have asked how to print two Images 5mm apart. Even if the Images are displayed in PictureBoxes on a form, those PictureBoxes are still not relevant to the printing part.
Unfortunately, I can only help with the terminology. I've not done a great deal of printing so I'm no expert. I'd assume that it would have something to do with the DPI setting of the printer, but I was unable to find anything relevant when I looked through the classes that I know get used in GDI+ printing, e.g. PrinterSettings and PageSettings.
Merrion is our local printing expert so it might not be a bad idea to send him a PM and provide a link to this thread. He usually replies to questions on printing but he's not going to realise that this thread is about printing without reading it, which he probably won't do without knowing that it's about printing.
okay, I'll do thatQuote:
Merrion is our local printing expert so it might not be a bad idea to send him a PM and provide a link to this thread.
Graphics measurements in printing are in tenths of a millimetre - e.g., to print a rectangle 4 x 5 centimetres, you would use e.Graphics.DrawRectangle(Pens.Black, 10, 10, 4000, 5000)
To do this for a picture, use the Graphics.DrawImage overload that takes a x,y, width and height. If it is not the same aspect ratio as the source image it will be stretched/squashed to fit.
See also the Guide to printing in .NET
Your example would seem to indicate hundredths of a millimetre.
There are 10 millimeters in a centimeter, and 1/10th of a millimeter would mean 100 printing units per centimeter, so 4 centimeters would be 400 printing units (400 tenths of a millimeter), not 4000. If 1000 is the correct number for 1 centimeter, then there would be 100 units per 1 mm, not 10.
Oops - yeah, my maths is terrible.