Пример #1
0
        /// <summary>
        /// 渲染线段
        /// </summary>
        /// <param name="pt1">起点</param>
        /// <param name="pt2">终点</param>
        public void RenderLine(Point pt1, Point pt2)
        {
            if (this.m_State == State.Hidden || pt1 == pt2)
            {
                return;
            }

            //使用边框颜色
            using (Brush brush = RenderEngine.CreateBrush(pt1, pt2, this.CurrentLineColor, this.m_LineBlendStyle))
            {
                using (Pen pen = RenderEngine.CreatePen(brush, this.m_LineWidth, this.m_LineDashStyle, this.m_LineDashPattern, this.m_LineDashCap, this.m_LineDashOffset))
                {
                    this.m_Graphics.DrawLine(pen, pt1, pt2);
                }
            }
        }
Пример #2
0
        /// <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);
                        }
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 渲染边框颜色(RoundStyle圆角样式,BorderStyle确定绘制哪个边,BlendStyle混合方式)
        /// </summary>
        /// <param name="rect">渲染区域</param>
        public void RenderBorder(Rectangle rect)
        {
            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))
                    {
                        RenderEngine.DrawBorder(this.m_Graphics, pen, this.CurrentInnerBorderPathRect, this.m_InnerBorderVisibleStyle, this.m_RoundCornerStyle, this.m_RoundStyle, this.m_RoundRadius, false);
                    }
                }
            }

            //绘制边框
            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))
                    {
                        RenderEngine.DrawBorder(this.m_Graphics, pen, this.CurrentBorderPathRect, this.m_BorderVisibleStyle, this.m_RoundCornerStyle, this.m_RoundStyle, this.m_RoundRadius, false);
                    }
                }
            }
        }