David, yes that was my gut feeling and I eventually got the right properties
and numbers to scale with
PB.Image.Height 2048
PB.Image.Width 1536
PreferredSize {Width=278, Height=264}
But I used the PB w/o a Panel since the border looks OK
Using those I can resize the PB itself so that the longest dimension of the
image fits the space I have available. (I have plenty of Y space - Height is
not a constraint, only the PB Width was my constraining dimension).
private void pictureBoxPreview_LoadCompleted(object sender,
System.ComponentModel.AsyncCompletedEventArgs e)
{
double scaleFactor =
Convert.ToDouble(pictureBoxPreview.Image.Width) /
Convert.ToDouble(pictureBoxPreview.Image.Height);
// MaximumSize needs to be 0,0 (ie, dynamic) or this will not
work
pictureBoxPreview.MaximumSize = new System.Drawing.Size(0, 0);
int NewHeight = Convert.ToInt32((pictureBoxPreview.Width /
scaleFactor));
pictureBoxPreview.Height = NewHeight;
}
A trivial problem, I know.
_____
Ian Thomas
Victoria Park, Western Australia