private void SetClientSize(System.Drawing.Size size)
{
var screenSize = Screen.PrimaryScreen.Bounds.Size;
if (size.Width > screenSize.Width)
{
double ratio = (double)screenSize.Width / size.Width;
size.Width = Convert.ToInt32(size.Width * ratio);
size.Height = Convert.ToInt32(size.Height * ratio);
}
if (size.Height > screenSize.Height)
{
double ratio = (double)screenSize.Height / size.Height;
size.Width = Convert.ToInt32(size.Width * ratio);
size.Height = Convert.ToInt32(size.Height * ratio);
}
ClientSize = new System.Drawing.Size(size.Width, size.Height);
}
#endregion