Example #1
0
 public TitleBar(Form owner, TitleBarStyles titleBarStyle)
 {
     this._f          = owner;
     this._formHelper = new FormHelper(owner);
     this.init();
     Moveable = true;
     Style    = titleBarStyle;
     Show();
 }
Example #2
0
        private void resetStyle(TitleBarStyles titleBarStyle)
        {
            this._tPanel.Controls.Add(this._minLabel);
            this._tPanel.Controls.Add(this._maxLabel);
            this._tPanel.Controls.Add(this._endLabel);
            switch (titleBarStyle)
            {
            case TitleBarStyles.None:
                this._tPanel.Controls.Remove(_minLabel);
                this._tPanel.Controls.Remove(_maxLabel);
                this._tPanel.Controls.Remove(_endLabel);
                break;

            case TitleBarStyles.MinOnly:
                this._tPanel.Controls.Remove(_maxLabel);
                this._tPanel.Controls.Remove(_endLabel);
                break;

            case TitleBarStyles.MaxOnly:
                this._tPanel.Controls.Remove(_minLabel);
                this._tPanel.Controls.Remove(_endLabel);
                break;

            case TitleBarStyles.EndOnly:
                this._tPanel.Controls.Remove(_minLabel);
                this._tPanel.Controls.Remove(_maxLabel);
                break;

            case TitleBarStyles.MinMax:
                this._tPanel.Controls.Remove(_endLabel);
                break;

            case TitleBarStyles.MinEnd:
                this._tPanel.Controls.Remove(_maxLabel);
                break;

            case TitleBarStyles.MaxEnd:
                this._tPanel.Controls.Remove(_minLabel);
                break;

            case TitleBarStyles.MinMaxEnd:
                break;

            default:
                throw new Exception("titleBarStyle类型错误");
            }
            this._style = titleBarStyle;
            this.resetControlLocation();
        }