OpenCvSharp.UserInterface.CvWindowEx.SetClientSize C# (CSharp) Method

SetClientSize() private method

ClientSizeを画面からはみ出ない大きさに調整して設定する.
private SetClientSize ( System size ) : void
size System
return void
        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