/// <summary> /// ShowHideControls /// </summary> /// <param name="sender"></param> private void ShowHideControls(object sender) { if (DisplayStatusE.Show == _DisplayStatus) { if (0 == ControlHeight) { ControlHeight = this.Height; } while (this.Height >= _TopPanel.Height) { this.Invoke(new Action(delegate() { this.Height -= INCRIMENT_BY; })); Thread.Sleep(SLEEP_TIME); } this.Invoke(new Action(delegate() { this.Height = _TopPanel.Height; })); _DisplayStatus = DisplayStatusE.Hide; } else { while (this.Height <= ControlHeight) { this.Invoke(new Action(delegate() { this.Height += INCRIMENT_BY; })); Thread.Sleep(SLEEP_TIME); } this.Invoke(new Action(delegate() { this.Height = ControlHeight; })); _DisplayStatus = DisplayStatusE.Show; } }
/// <summary> /// InitializeComponentsG /// </summary> private void InitializeComponentsG() { _DisplayStatus = DisplayStatusE.Show; _TopPanel = new Panel(); _ShowHideButton = new ColorButton(); _ShowHideButton.Text = "#"; _ShowHideButton.ButtonStyle = ColorButton.ButtonStyles.Ellipse; _CaptionPanel = new Label(); _TopPanel.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); _CaptionPanel.Font = new Font("Arial", 12.75F); _CaptionPanel.Text = "XPanel"; _CaptionPanel.Dock = DockStyle.Fill; _ShowHideButton.Click += new EventHandler(showHideButton_Click); _ShowHideButton.Width = 50; _ShowHideButton.Dock = DockStyle.Right; _TopPanel.Controls.Add(_ShowHideButton); _TopPanel.Controls.Add(_CaptionPanel); _TopPanel.Height = 50; _TopPanel.Dock = DockStyle.Top; this.Controls.Add(_TopPanel); }