/// <summary> /// 渲染标签样式分组控件背景色 /// </summary> /// <param name="rect">渲染区域</param> /// <param name="tabSize">左上角标签大小</param> /// <param name="tabRound">标签右上角是否发圆角</param> /// <param name="tabRadius">标签右上角圆角半径</param> public void RenderBackColorGroupBoxTab(Rectangle rect, Size tabSize, bool tabRound, float tabRadius) { this.m_BackColorRect = rect; if (this.m_State == State.Hidden || !RectangleEx.IsVisible(this.m_BackColorRect)) { return; } using (Brush brush = RenderEngine.CreateBrush(this.CurrentBackColorBrushRect, this.CurrentBackColor, this.m_BackColorPos1, this.m_BackColorPos2, this.CurrentBackColorReverse, this.CurrentBackColorMode, this.m_BackColorBlendStyle)) { //校正背景区域 if (this.m_InnerBorderVisibleStyle != BorderVisibleStyle.None) { tabSize.Width -= 4; } else if (this.m_BorderVisibleStyle != BorderVisibleStyle.None) { tabSize.Width -= 2; } using (GraphicsPath path = RenderEngine.CreateGroupBoxTabGraphicsPath(this.CurrentBackColorPathRect, this.m_RoundStyle, this.m_RoundRadius, tabSize, tabRound, tabRadius, false)) { this.m_Graphics.SetClip(path, CombineMode.Intersect); this.m_Graphics.FillPath(brush, path); } } }
/// <summary> /// 渲染标签样式分组控件边框色 /// </summary> /// <param name="rect">渲染区域</param> /// <param name="tabSize">左上角标签大小</param> /// <param name="tabRound">标签右上角是否发圆角</param> /// <param name="tabRadius">标签右上角圆角半径</param> public void RenderBorderColorGroupBoxTab(Rectangle rect, Size tabSize, bool tabRound, float tabRadius) { this.m_BorderColorRect = rect; if (this.m_State == State.Hidden || !RectangleEx.IsVisible(this.m_BorderColorRect)) { return; } //重置剪切区 this.m_Graphics.SetClip(this.m_GraphicsClip, CombineMode.Replace); //绘制内边框 if (this.m_InnerBorderVisibleStyle != BorderVisibleStyle.None) { using (Brush brush = RenderEngine.CreateBrush(this.CurrentInnerBorderBrushRect, this.CurrentInnerBorderColor, this.m_InnerBorderColorPos1, this.m_InnerBorderColorPos2, this.CurrentBackColorReverse, this.CurrentBackColorMode, this.m_InnerBorderBlendStyle)) { using (Pen pen = RenderEngine.CreatePen(brush, 1, this.m_InnerBorderDashStyle, this.m_InnerBorderDashPattern, this.m_InnerBorderDashCap, this.m_InnerBorderDashOffset)) { Size innerBorderTabSize = new Size(tabSize.Width - 3, tabSize.Height); using (GraphicsPath path = RenderEngine.CreateGroupBoxTabGraphicsPath(this.CurrentInnerBorderPathRect, this.m_RoundStyle, this.m_RoundRadius, innerBorderTabSize, tabRound, tabRadius, false)) { this.m_Graphics.DrawPath(pen, path); } } } } //绘制边框 if (this.m_BorderVisibleStyle != BorderVisibleStyle.None) { using (Brush brush = RenderEngine.CreateBrush(this.CurrentBorderBrushRect, this.CurrentBorderColor, this.m_BorderColorPos1, this.m_BorderColorPos2, this.CurrentBackColorReverse, this.CurrentBackColorMode, this.m_BorderBlendStyle)) { using (Pen pen = RenderEngine.CreatePen(brush, 1, this.m_BorderDashStyle, this.m_BorderDashPattern, this.m_BorderDashCap, this.m_BorderDashOffset)) { Size borderTabSize = new Size(tabSize.Width - 1, tabSize.Height); using (GraphicsPath path = RenderEngine.CreateGroupBoxTabGraphicsPath(this.CurrentBorderPathRect, this.m_RoundStyle, this.m_RoundRadius, borderTabSize, tabRound, tabRadius, false)) { this.m_Graphics.DrawPath(pen, path); } } } } }