/// <summary> /// Sets the PanelStyle and PanelColors table in the given control collection. /// </summary> /// <param name="controls">a collection of child controls</param> /// <param name="panelStyle">Style of the panel</param> /// <param name="panelColors">The PanelColors table</param> public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors) { if (panelColors == null) { throw new ArgumentNullException("panelColors", string.Format(System.Globalization.CultureInfo.InvariantCulture, Windows.Forms.Properties.Resources.IDS_ArgumentException, "panelColors")); } ArrayList panels = FindPanels(true, controls); foreach (BasePanel panel in panels) { panel.PanelStyle = panelStyle; panelColors.Panel = panel; panel.SetPanelProperties(panelColors); } }
/// <summary> /// Initializes a new instance of the BasePanel class. /// </summary> protected BasePanel() { this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.ContainerControl, true); this.CaptionFont = new Font(SystemFonts.CaptionFont.FontFamily, SystemFonts.CaptionFont.SizeInPoints - 1.0F, FontStyle.Bold); this.CaptionForeColor = SystemColors.ActiveCaptionText; this.CloseIconForeColor = SystemColors.ActiveCaptionText; this.CaptionHeight = 25; this.BorderColor = ProfessionalColors.ToolStripBorder; this.InnerBorderColor = Color.White; this.ColorCaptionGradientBegin = ProfessionalColors.OverflowButtonGradientBegin; this.ColorCaptionGradientMiddle = ProfessionalColors.OverflowButtonGradientMiddle; this.ColorCaptionGradientEnd = ProfessionalColors.OverflowButtonGradientEnd; this.PanelStyle = PanelStyle.Default; this.m_panelColors = new PanelColors(this); //this.m_imageSize = new Size(16, 16); //Ĭ�� //this.m_imageSize = new Size(32, 32); //����ͼƬ����ʾ��С this.m_imageSize = new Size(I_ImageSizeWH, I_ImageSizeWH); //�Զ����С this.m_imageRectangle = Rectangle.Empty; }
/// <summary> /// Sets the PanelProperties for the Panel /// </summary> /// <param name="panelColors">The PanelColors table</param> public void SetPanelProperties(PanelColors panelColors) { if (panelColors == null) { throw new ArgumentException( string.Format( System.Globalization.CultureInfo.CurrentUICulture, Resources.IDS_ArgumentException, "panelColors")); } this.m_panelColors = panelColors; this.ColorScheme = ColorScheme.Professional; this.Invalidate(true); }
/// <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: case PanelStyle.Aqua: m_panelColors = new PanelColors(this); break; case PanelStyle.Office2007: m_panelColors = new PanelColorsOffice2007(this); break; } Invalidate(true); if (this.PanelStyleChanged != null) { this.PanelStyleChanged(sender, e); } }