private void XpanderPanelPanelStyleChanged(object sender, PanelStyleChangeEventArgs e) { PanelStyle panelStyle = e.PanelStyle; if (panelStyle != this.m_ePanelStyle) { this.PanelStyle = panelStyle; } }
/// <summary> /// Raises the PanelStyle changed event /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A PanelStyleChangeEventArgs that contains the event data.</param> protected virtual void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e) { PanelStyle panelStyle = e.PanelStyle; if (panelStyle != PanelStyle.Aqua) { this.Padding = new System.Windows.Forms.Padding(0); } else { this.Padding = new System.Windows.Forms.Padding(3); } foreach (XPanderPanel xpanderPanel in this.XPanderPanels) { PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(xpanderPanel); if (propertyDescriptorCollection.Count > 0) { PropertyDescriptor propertyDescriptorPanelStyle = propertyDescriptorCollection["PanelStyle"]; if (propertyDescriptorPanelStyle != null) { propertyDescriptorPanelStyle.SetValue(xpanderPanel, panelStyle); } PropertyDescriptor propertyDescriptorLeft = propertyDescriptorCollection["Left"]; if (propertyDescriptorLeft != null) { propertyDescriptorLeft.SetValue(xpanderPanel, this.Padding.Left); } PropertyDescriptor propertyDescriptorWidth = propertyDescriptorCollection["Width"]; if (propertyDescriptorWidth != null) { propertyDescriptorWidth.SetValue( xpanderPanel, this.ClientRectangle.Width - this.Padding.Left - this.Padding.Right); } } } if (this.PanelStyleChanged != null) { this.PanelStyleChanged(sender, e); } }
/// <summary> /// Raises the PanelStyleChanged event /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A EventArgs that contains the event data.</param> protected override void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e) { OnLayout(new LayoutEventArgs(this, null)); base.OnPanelStyleChanged(sender, e); }