private void ToggleState(object sender, EventArgs e) { if (this._isCollapsed) { base.SetBounds(base.Location.X, base.Location.Y, base.Size.Width, this._expandedHeight); } else { base.SetBounds(base.Location.X, base.Location.Y, base.Size.Width, this.titlePanel.Height); } this._isCollapsed = !this._isCollapsed; if (this._isCollapsed) { this._panelState = PanelStateOptions.Collapsed; this.labTitle.Text = "+"; } else { this._panelState = PanelStateOptions.Expanded; this.labTitle.Text = "-"; } if (!base.DesignMode && this.StateChanged != null) { this.StateChanged(this, new EventArgs()); } }
/// <summary> /// Changes the current state from Collapsed to Expanded or viceversa /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToggleState(object sender, EventArgs e) { if (_isCollapsed) { ///Current state is Collapsed. Expand the user control this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height + _expandedHeight); } else { ///Current state is Expanded. Collapse the user control this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height); } _isCollapsed = !_isCollapsed; ///Setting content control current state and toggling image if (_isCollapsed) { _panelState = PanelStateOptions.Collapsed; togglingImage.Image = global::SDRSharp.CollapsiblePanel.Properties.Resources.ExpandedIcon; } else { _panelState = PanelStateOptions.Expanded; togglingImage.Image = global::SDRSharp.CollapsiblePanel.Properties.Resources.CollapsedIcon; } if (!this.DesignMode) { if (StateChanged != null) { ///Fire the event to inform the parent control that the state for the user control has changed StateChanged(); } } }
/// <summary> /// Changes the current state from Collapsed to Expanded or viceversa /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToggleState(object sender, EventArgs e) { if (_isCollapsed) { ///Current state is Collapsed. Expand the user control this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height + _expandedHeight); } else { ///Current state is Expanded. Collapse the user control this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height); } _isCollapsed = !_isCollapsed; ///Setting content control current state and toggling image if (_isCollapsed) { _panelState = PanelStateOptions.Collapsed; togglingImage.Image = global::SDRSharp.CollapsiblePanel.Properties.Resources.ExpandedIcon; } else { _panelState = PanelStateOptions.Expanded; togglingImage.Image = global::SDRSharp.CollapsiblePanel.Properties.Resources.CollapsedIcon; } if (!this.DesignMode) { if (StateChanged != null) { ///Fire the event to inform the parent control that the state for the user control has changed StateChanged(); } } }
private void ToggleState(object sender, EventArgs e) { this._panelState = ((this._panelState == PanelStateOptions.Collapsed) ? PanelStateOptions.Expanded : PanelStateOptions.Collapsed); this.UpdateState(); }
private void ToggleState(object sender, EventArgs e) { this._panelState = this._panelState == PanelStateOptions.Collapsed ? PanelStateOptions.Expanded : PanelStateOptions.Collapsed; this.UpdateState(); }
private void ToggleState(object sender, EventArgs e) { if (_isCollapsed) { this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height + _expandedHeight); } else { this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height); } _isCollapsed = !_isCollapsed; if (_isCollapsed) { _panelState = PanelStateOptions.Collapsed; togglingImage.Image = Properties.Resources.down_24; } else { _panelState = PanelStateOptions.Expanded; togglingImage.Image = Properties.Resources.up_24; } if (!this.DesignMode) { if (StateChanged != null) StateChanged(); } }