/// <summary> /// Raises the Paint event. /// </summary> /// <param name="e">A PaintEventArgs that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { if (IsZeroWidthOrHeight(this.CaptionRectangle) == true) { return; } using (UseAntiAlias antiAlias = new UseAntiAlias(e.Graphics)) { Graphics graphics = e.Graphics; using (UseClearTypeGridFit clearTypeGridFit = new UseClearTypeGridFit(graphics)) { bool bExpand = this.Expand; bool bShowBorder = this.ShowBorder; Color borderColor = this.PanelColors.BorderColor; Rectangle borderRectangle = this.ClientRectangle; switch (this.PanelStyle) { case PanelStyle.Default: case PanelStyle.Office2007: DrawCaptionbar(graphics, bExpand, bShowBorder, this.PanelStyle); CalculatePanelHeights(); DrawBorders(graphics, this); break; } } } }
/// <summary> /// Raises the Paint event. /// </summary> /// <param name="e">A PaintEventArgs that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { PanelStyle panelStyle = this.PanelStyle; if (this.m_bShowCaptionbar == false) { return; } using (UseAntiAlias antiAlias = new UseAntiAlias(e.Graphics)) { Graphics graphics = e.Graphics; using (UseClearTypeGridFit clearTypeGridFit = new UseClearTypeGridFit(graphics)) { Rectangle captionRectangle = this.CaptionRectangle; Color colorGradientBegin = this.PanelColors.PanelCaptionGradientBegin; Color colorGradientEnd = this.PanelColors.PanelCaptionGradientEnd; Color colorGradientMiddle = this.PanelColors.PanelCaptionGradientMiddle; Color colorText = this.PanelColors.PanelCaptionText; bool bShowXPanderPanelProfessionalStyle = this.ShowXPanderPanelProfessionalStyle; ColorScheme colorSchema = this.ColorScheme; if ((bShowXPanderPanelProfessionalStyle == true) && (colorSchema == ColorScheme.Professional) && (panelStyle != PanelStyle.Office2007)) { colorGradientBegin = this.PanelColors.XPanderPanelCaptionGradientBegin; colorGradientEnd = this.PanelColors.XPanderPanelCaptionGradientEnd; colorGradientMiddle = this.PanelColors.XPanderPanelCaptionGradientMiddle; colorText = this.PanelColors.XPanderPanelCaptionText; } Image image = this.Image; RightToLeft rightToLeft = this.RightToLeft; Font captionFont = this.CaptionFont; Rectangle clientRectangle = this.ClientRectangle; string strText = this.Text; DockStyle dockStyle = this.Dock; bool bExpand = this.Expand; if (this.m_imageClosePanel == null) { this.m_imageClosePanel = Resources.closePanel; } Color colorCloseIcon = this.PanelColors.PanelCaptionCloseIcon; if (colorCloseIcon == Color.Empty) { colorCloseIcon = colorText; } bool bShowExpandIcon = this.ShowExpandIcon; bool bShowCloseIcon = this.ShowCloseIcon; switch (panelStyle) { case SkyCar.Framework.WindowUI.Controls.PanelStyle.Default: case PanelStyle.Office2007: DrawStyleDefault(graphics, captionRectangle, colorGradientBegin, colorGradientEnd, colorGradientMiddle); break; } DrawBorder( graphics, clientRectangle, captionRectangle, this.PanelColors.BorderColor, this.PanelColors.InnerBorderColor); if ((dockStyle == DockStyle.Fill) || (dockStyle == DockStyle.None) || ((bShowExpandIcon == false) && (bShowCloseIcon == false))) { DrawImagesAndText( graphics, captionRectangle, CaptionSpacing, this.ImageRectangle, image, rightToLeft, captionFont, colorText, strText); return; } if ((bShowExpandIcon == true) || (bShowCloseIcon == true)) { Image imageExpandPanel = GetExpandImage(dockStyle, bExpand); DrawImagesAndText( graphics, dockStyle, CaptionSpacing, captionRectangle, clientRectangle, this.ImageRectangle, image, rightToLeft, bShowCloseIcon, this.m_imageClosePanel, colorCloseIcon, ref this.RectangleCloseIcon, bShowExpandIcon, bExpand, imageExpandPanel, colorText, ref this.RectangleExpandIcon, captionFont, colorText, this.PanelColors.PanelCollapsedCaptionText, strText); if (this.m_imgHoverBackground == null) { this.m_imgHoverBackground = GetPanelIconBackground( graphics, this.ImageRectangle, this.PanelColors.PanelCaptionSelectedGradientBegin, this.PanelColors.PanelCaptionSelectedGradientEnd); } if (this.m_imgHoverBackground != null) { Rectangle rectangleCloseIcon = this.RectangleCloseIcon; if (rectangleCloseIcon != Rectangle.Empty) { if (this.HoverStateCloseIcon == HoverState.Hover) { graphics.DrawImage(this.m_imgHoverBackground, rectangleCloseIcon); DrawIcon(graphics, this.m_imageClosePanel, rectangleCloseIcon, colorCloseIcon, rectangleCloseIcon.Y); } } Rectangle rectangleExpandIcon = this.RectangleExpandIcon; if (rectangleExpandIcon != Rectangle.Empty) { if (this.HoverStateExpandIcon == HoverState.Hover) { graphics.DrawImage(this.m_imgHoverBackground, rectangleExpandIcon); DrawIcon(graphics, imageExpandPanel, rectangleExpandIcon, colorText, rectangleExpandIcon.Y); } } } } } } }