Example #1
0
        protected void SystemBtnSet()
        {
            if (this.MaximizeBox && this.MinimizeBox)
                _FormSystemBtnSet = FormSystemBtn.SystemAll;
            else if (this.MaximizeBox && !this.MinimizeBox)
                _FormSystemBtnSet = FormSystemBtn.btn_maxAndbtn_close;
            else if (!this.MaximizeBox && this.MinimizeBox)
                _FormSystemBtnSet = FormSystemBtn.btn_miniAndbtn_close;
            else if (!this.MaximizeBox && !this.MinimizeBox)
                _FormSystemBtnSet = FormSystemBtn.btn_close;
            else
                _FormSystemBtnSet = FormSystemBtn.SystemNo;

            switch ((int)_FormSystemBtnSet)
            {
                case 0:
                    btn_close.BackgroundImage = btn_closeImg;
                    btn_close.Location = new Point(this.Width - 43, 5);
                    btn_mini.BackgroundImage = btn_miniImg;
                    btn_mini.Location = new Point(this.Width - 93, 5);
                    btn_max.BackgroundImage = btn_maxImg;
                    btn_restore.BackgroundImage = btn_restoreImg;
                    if (WindowState == FormWindowState.Normal)
                    {
                        btn_max.Location = new Point(this.Width - 68, 5);
                        btn_restore.Location = new Point(this.Width - 68, -19);
                    }
                    else
                    {
                        btn_max.Location = new Point(this.Width - 68, -19);
                        btn_restore.Location = new Point(this.Width - 68, 5);
                    }
                    break;
                case 1:
                    btn_close.BackgroundImage = btn_closeImg;
                    btn_close.Location = new Point(this.Width - 43, -19);
                    btn_max.BackgroundImage = btn_maxImg;
                    btn_max.Location = new Point(this.Width - 68, -19);
                    btn_mini.BackgroundImage = btn_miniImg;
                    btn_mini.Location = new Point(this.Width - 93, -19);
                    btn_restore.BackgroundImage = btn_restoreImg;
                    btn_restore.Location = new Point(this.Width - 68, -19);
                    break;
                case 2:
                    btn_close.BackgroundImage = btn_closeImg;
                    btn_close.Location = new Point(this.Width - 43, 5);
                    btn_max.BackgroundImage = btn_maxImg;
                    btn_max.Location = new Point(this.Width - 68, -19);
                    btn_mini.BackgroundImage = btn_miniImg;
                    btn_mini.Location = new Point(this.Width - 93, -19);
                    btn_restore.BackgroundImage = btn_restoreImg;
                    btn_restore.Location = new Point(this.Width - 68, -19);
                    break;
                case 3:
                    btn_close.BackgroundImage = btn_closeImg;
                    btn_close.Location = new Point(this.Width - 43, 5);
                    btn_max.BackgroundImage = btn_maxImg;
                    btn_max.Location = new Point(this.Width - 68, -19);
                    btn_mini.BackgroundImage = btn_miniImg;
                    btn_mini.Location = new Point(this.Width - 68, 5);
                    btn_restore.BackgroundImage = btn_restoreImg;
                    btn_restore.Location = new Point(this.Width - 68, -19);
                    break;
                case 4:
                    btn_close.BackgroundImage = btn_closeImg;
                    btn_close.Location = new Point(this.Width - 43, 5);
                    btn_mini.BackgroundImage = btn_miniImg;
                    btn_mini.Location = new Point(this.Width - 93, -19);
                    btn_max.BackgroundImage = btn_maxImg;
                    btn_restore.BackgroundImage = btn_restoreImg;
                    if (WindowState == FormWindowState.Normal)
                    {
                        btn_max.Location = new Point(this.Width - 68, 5);
                        btn_restore.Location = new Point(this.Width - 68, -19);
                    }
                    else
                    {
                        btn_max.Location = new Point(this.Width - 68, -19);
                        btn_restore.Location = new Point(this.Width - 68, 5);
                    }
                    break;

            }
        }
Example #2
0
        protected void SystemBtnSet()
        {
            if (this.MaximizeBox && this.MinimizeBox)
            {
                _FormSystemBtnSet = FormSystemBtn.SystemAll;
            }
            else if (this.MaximizeBox && !this.MinimizeBox)
            {
                _FormSystemBtnSet = FormSystemBtn.btn_maxAndbtn_close;
            }
            else if (!this.MaximizeBox && this.MinimizeBox)
            {
                _FormSystemBtnSet = FormSystemBtn.btn_miniAndbtn_close;
            }
            else if (!this.MaximizeBox && !this.MinimizeBox)
            {
                _FormSystemBtnSet = FormSystemBtn.btn_close;
            }
            else
            {
                _FormSystemBtnSet = FormSystemBtn.SystemNo;
            }

            switch ((int)_FormSystemBtnSet)
            {
            case 0:
                btn_close.BackgroundImage   = btn_closeImg;
                btn_close.Location          = new Point(this.Width - 43, 5);
                btn_mini.BackgroundImage    = btn_miniImg;
                btn_mini.Location           = new Point(this.Width - 93, 5);
                btn_max.BackgroundImage     = btn_maxImg;
                btn_restore.BackgroundImage = btn_restoreImg;
                if (WindowState == FormWindowState.Normal)
                {
                    btn_max.Location     = new Point(this.Width - 68, 5);
                    btn_restore.Location = new Point(this.Width - 68, -19);
                }
                else
                {
                    btn_max.Location     = new Point(this.Width - 68, -19);
                    btn_restore.Location = new Point(this.Width - 68, 5);
                }
                break;

            case 1:
                btn_close.BackgroundImage   = btn_closeImg;
                btn_close.Location          = new Point(this.Width - 43, -19);
                btn_max.BackgroundImage     = btn_maxImg;
                btn_max.Location            = new Point(this.Width - 68, -19);
                btn_mini.BackgroundImage    = btn_miniImg;
                btn_mini.Location           = new Point(this.Width - 93, -19);
                btn_restore.BackgroundImage = btn_restoreImg;
                btn_restore.Location        = new Point(this.Width - 68, -19);
                break;

            case 2:
                btn_close.BackgroundImage   = btn_closeImg;
                btn_close.Location          = new Point(this.Width - 43, 5);
                btn_max.BackgroundImage     = btn_maxImg;
                btn_max.Location            = new Point(this.Width - 68, -19);
                btn_mini.BackgroundImage    = btn_miniImg;
                btn_mini.Location           = new Point(this.Width - 93, -19);
                btn_restore.BackgroundImage = btn_restoreImg;
                btn_restore.Location        = new Point(this.Width - 68, -19);
                break;

            case 3:
                btn_close.BackgroundImage   = btn_closeImg;
                btn_close.Location          = new Point(this.Width - 43, 5);
                btn_max.BackgroundImage     = btn_maxImg;
                btn_max.Location            = new Point(this.Width - 68, -19);
                btn_mini.BackgroundImage    = btn_miniImg;
                btn_mini.Location           = new Point(this.Width - 68, 5);
                btn_restore.BackgroundImage = btn_restoreImg;
                btn_restore.Location        = new Point(this.Width - 68, -19);
                break;

            case 4:
                btn_close.BackgroundImage   = btn_closeImg;
                btn_close.Location          = new Point(this.Width - 43, 5);
                btn_mini.BackgroundImage    = btn_miniImg;
                btn_mini.Location           = new Point(this.Width - 93, -19);
                btn_max.BackgroundImage     = btn_maxImg;
                btn_restore.BackgroundImage = btn_restoreImg;
                if (WindowState == FormWindowState.Normal)
                {
                    btn_max.Location     = new Point(this.Width - 68, 5);
                    btn_restore.Location = new Point(this.Width - 68, -19);
                }
                else
                {
                    btn_max.Location     = new Point(this.Width - 68, -19);
                    btn_restore.Location = new Point(this.Width - 68, 5);
                }
                break;
            }
        }