Rectangle GetPreviewBounds()
{
double horizontalScale = 1.0;
double verticalScale = 1.0;
if (_previewBox.Image.Width > ClientRectangle.Width)
horizontalScale = (double)(ClientRectangle.Width) / (double)(_previewBox.Image.Width);
if (_previewBox.Image.Height > ClientRectangle.Height)
verticalScale = (double)(ClientRectangle.Height) / (double)(_previewBox.Image.Height);
double scale = Math.Min(horizontalScale, verticalScale);
int widthPreview = (int)(_previewBox.Image.Width * scale);
int heightPreview = (int)(_previewBox.Image.Height * scale);
var sizePreview = new Size(widthPreview, heightPreview);
var xPreview = ClientRectangle.Width - widthPreview;
var yPreview = ClientRectangle.Height - heightPreview;
var originPreview = new Point(xPreview, yPreview);
return new Rectangle(originPreview, sizePreview);
}