private void PanderPanelWPanelStyleChanged(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; this.Padding = new System.Windows.Forms.Padding(0); foreach (PanderPanelW PanderPanelW in this.PanderPanelWs) { PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(PanderPanelW); if (propertyDescriptorCollection.Count > 0) { PropertyDescriptor propertyDescriptorPanelStyle = propertyDescriptorCollection["PanelStyle"]; if (propertyDescriptorPanelStyle != null) { propertyDescriptorPanelStyle.SetValue(PanderPanelW, panelStyle); } PropertyDescriptor propertyDescriptorLeft = propertyDescriptorCollection["Left"]; if (propertyDescriptorLeft != null) { propertyDescriptorLeft.SetValue(PanderPanelW, this.Padding.Left); } PropertyDescriptor propertyDescriptorWidth = propertyDescriptorCollection["Width"]; if (propertyDescriptorWidth != null) { propertyDescriptorWidth.SetValue( PanderPanelW, this.ClientRectangle.Width - this.Padding.Left - this.Padding.Right); } } } if (this.PanelStyleChanged != null) { this.PanelStyleChanged(sender, e); } }
/// <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; switch (panelStyle) { case PanelStyle.Default: m_panelColors = new PanelColors(this); break; case PanelStyle.Office2007: m_panelColors = new PanelColorsOffice2007Blue(this); break; } Invalidate(true); 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); }