Figure Out Percentages
Posted on 2010-11-25
I am hoping that the experts can help me out with some calculations.
I am scanning an image (using EZTwain Pro). I place the scanned image in a Picture Box to allow manual cropping. When I place the image in the picture box, it shrinks it down to fit the picture box.
I know the size of the scanned image, and I know the size of the picture box.
I have to figure out how much percent smaller the picture box is than the scanned image. Then, when dragging my crop box over the image, I have to add (or multiply - I'm not sure) the percentage so that I can manipulate the scanned image (in memory).
The scanned image is 200 High X 100 Wide.
The Picture Box is 100 High X 50 Wide.
How do I figure out how much percent smaller the Picture Box is than the scanned image?
Then, lets say I drag the crop box as follows:
picBox.Left = 10
picBox.Top = 20
CropBox.Width = 15
CropBox.Heigh = 25
Once I figure out how much percent smaller the PictureBox is, how do I go back to the scanned image and muliply? (by the percentage) the dimensions of my crop box (as if I am working on the larger scanned image?