|
-
Oct 2nd, 2014, 07:48 AM
#1
Thread Starter
Lively Member
set distance between two pictureboxes in millimeters.
Hello
I have two pictureboxes and I want them to be placed 5 millimeters away from each other. How can I do that?
Thanks
-
Oct 2nd, 2014, 07:59 AM
#2
Re: set distance between two pictureboxes in millimeters.
How you define 5mm on a Form? Or are you talking about a printed page?
-
Oct 2nd, 2014, 08:08 AM
#3
Thread Starter
Lively Member
Re: set distance between two pictureboxes in millimeters.
-
Oct 2nd, 2014, 08:15 AM
#4
Re: set distance between two pictureboxes in millimeters.
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?
-
Oct 2nd, 2014, 08:19 AM
#5
Re: set distance between two pictureboxes in millimeters.
 Originally Posted by bruel1999
On a printed page.
In that case they're not PictureBoxes, they're just images drawn on the printing surface.
-
Oct 2nd, 2014, 08:30 AM
#6
Thread Starter
Lively Member
Re: set distance between two pictureboxes in millimeters.
 Originally Posted by jmcilhinney
In that case they're not PictureBoxes, they're just images drawn on the printing surface.
I meant, when printed, the two pictureboxes should be 5 mm apa
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?
Let's assume only one computer will be used.
-
Oct 2nd, 2014, 09:53 PM
#7
Re: set distance between two pictureboxes in millimeters.
 Originally Posted by bruel1999
I meant, when printed, the two pictureboxes should be 5 mm apa
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.
-
Oct 3rd, 2014, 02:57 AM
#8
Thread Starter
Lively Member
Re: set distance between two pictureboxes in millimeters.
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.
okay, I'll do that
-
Oct 3rd, 2014, 03:44 AM
#9
Re: set distance between two pictureboxes in millimeters.
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
-
Oct 3rd, 2014, 04:14 AM
#10
Re: set distance between two pictureboxes in millimeters.
 Originally Posted by Merrion
Graphics measurements in printing are in tenths of a millimetre
Huh, I didn't know that. That does make it easy.
-
Oct 3rd, 2014, 05:17 AM
#11
Re: set distance between two pictureboxes in millimeters.
 Originally Posted by Merrion
Graphics measurements in printing are in tenths of a millimetre - e.g., to print a rectangle 4 x 5 centimetres, you would use [B]e.Graphics.DrawRectangle(Pens.Black, 10, 10, 4000, 5000)
...
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.
Last edited by passel; Oct 3rd, 2014 at 05:22 AM.
-
Oct 3rd, 2014, 08:41 AM
#12
Re: set distance between two pictureboxes in millimeters.
Oops - yeah, my maths is terrible.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|