I'm currently writing a program that requires a preview of a live display, but the preview, of course, is scaled down. However, when I scale the PictureBox
down, the size is incorrect. For the scale to be correct the width and height need to be at a 4:3 ratio. Here's the code:
private void FindOptimalRes(PictureBox picBox)
{
double h = Height / 4;
double ratio = 4 / 3;
picBox.Size = new Size((int)(h * ratio), (int)h);
}
In testing, Height
(the height of the form) is 400, so, the width of the new size should be 133. But it always gets resized to 100×100! Why?