Beispiel #1
0
 /// <summary>
 /// Custom methods for handling controls.
 /// </summary>
 public void set_groupbox_location(GroupBox groupbox, int height)
 {
     groupbox.Location = new Point(DPIAwareScaling._ScaleX(23), height);
 }
Beispiel #2
0
        /// <summary>
        /// This is evil but we need it to prevent Windows DPI scaling issues :(
        /// </summary>
        public static void SetControlsExtendedDPISettings()
        {
            Console.WriteLine("## Display's DPI:");
            Console.WriteLine("# X: " + graphics.DpiX);
            Console.WriteLine("# Y: " + graphics.DpiY);
            Console.WriteLine("# Windows version: " + Environment.OSVersion.Version);

            if (DPIAwareScaling.graphics.DpiX == 96 && DPIAwareScaling.graphics.DpiY == 96)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -25;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 10;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 10;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 10;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 10;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 10;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 10;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -8;
                    DPIAwareScaling.MoveWindowY       = -31;
                    DPIAwareScaling.MoveWindowNWidth  = 5;
                    DPIAwareScaling.MoveWindowNHeight = 6;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 10;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 10;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 10;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 10;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 10;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 10;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 120 && DPIAwareScaling.graphics.DpiY == 120)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -28;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 11;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 11;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 11;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 11;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 11;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 11;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1050);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -9;
                    DPIAwareScaling.MoveWindowY       = -38;
                    DPIAwareScaling.MoveWindowNWidth  = 6;
                    DPIAwareScaling.MoveWindowNHeight = 6;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 11;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 11;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 11;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 11;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 11;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 11;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1050);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 144 && DPIAwareScaling.graphics.DpiY == 144)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -33;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -12;
                    DPIAwareScaling.MoveWindowY       = -50;
                    DPIAwareScaling.MoveWindowNWidth  = 15;
                    DPIAwareScaling.MoveWindowNHeight = 12;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 168 && DPIAwareScaling.graphics.DpiY == 168)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -39;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1020);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -12;
                    DPIAwareScaling.MoveWindowY       = -52;
                    DPIAwareScaling.MoveWindowNWidth  = 15;
                    DPIAwareScaling.MoveWindowNHeight = 12;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1020);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 192 && DPIAwareScaling.graphics.DpiY == 192)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -42;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -13;
                    DPIAwareScaling.MoveWindowY       = -58;
                    DPIAwareScaling.MoveWindowNWidth  = 15;
                    DPIAwareScaling.MoveWindowNHeight = 13;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 12;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 12;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 12;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 12;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 12;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(980);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 216 && DPIAwareScaling.graphics.DpiY == 216)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -45;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1025);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -14;
                    DPIAwareScaling.MoveWindowY       = -65;
                    DPIAwareScaling.MoveWindowNWidth  = 23;
                    DPIAwareScaling.MoveWindowNHeight = 13;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 11;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1025);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 240 && DPIAwareScaling.graphics.DpiY == 240)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -48;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1050);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -16;
                    DPIAwareScaling.MoveWindowY       = -72;
                    DPIAwareScaling.MoveWindowNWidth  = 23;
                    DPIAwareScaling.MoveWindowNHeight = 14;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1050);
                }
            }
            else if (DPIAwareScaling.graphics.DpiX == 288 && DPIAwareScaling.graphics.DpiY == 288)
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -51;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1070);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -18;
                    DPIAwareScaling.MoveWindowY       = -85;
                    DPIAwareScaling.MoveWindowNWidth  = 24;
                    DPIAwareScaling.MoveWindowNHeight = 16;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1070);
                }
            }
            else
            {
                if (DPIAwareScaling.UsingWindows7ClassicTheme())
                {
                    DPIAwareScaling.MoveWindowX       = -5;
                    DPIAwareScaling.MoveWindowY       = -54;
                    DPIAwareScaling.MoveWindowNWidth  = -1;
                    DPIAwareScaling.MoveWindowNHeight = -5;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1070);
                }
                else
                {
                    DPIAwareScaling.MoveWindowX       = -18;
                    DPIAwareScaling.MoveWindowY       = -85;
                    DPIAwareScaling.MoveWindowNWidth  = 24;
                    DPIAwareScaling.MoveWindowNHeight = 16;

                    DPIAwareScaling.NewConnectHostTextboxFont      = 13;
                    DPIAwareScaling.NewConnectUsernameTextboxFont  = 13;
                    DPIAwareScaling.NewConnectPasswordTextboxFont  = 13;
                    DPIAwareScaling.NewConnectSearchTextboxFont    = 13;
                    DPIAwareScaling.NewConnectNumericUpDownFont    = 13;
                    DPIAwareScaling.SearchSessionConfigTextBoxFont = 12;
                    DPIAwareScaling.TabcontrolFont             = 10;
                    DPIAwareScaling.TabControlSplitterDistance = 75;
                    DPIAwareScaling.KotarakSplitterDistance    = DPIAwareScaling._ScaleX(1070);
                }
            }
        }