/// <summary> /// 渲染对号(按比例渲染) /// </summary> /// <param name="rect">渲染区域</param> public void RenderCheck(Rectangle rect) { if (this.m_State == State.Hidden || !RectangleEx.IsVisible(rect)) { return; } this.CurrentTextPreferredRect = rect; RenderEngine.DrawCheck(this.m_Graphics, this.CurrentTextPreferredRect, this.CurrentForeColor); }
/// <summary> /// 绘制Metrol选中边框 /// </summary> /// <param name="rect">渲染区域</param> public void RenderMetroCheck(Rectangle rect) { if (this.m_State == State.Hidden || !RectangleEx.IsVisible(rect)) { return; } //左侧 if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Left) != 0) { rect.X += 2; rect.Width -= 2; } else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Left) != 0) { rect.X += 1; rect.Width -= 1; } //上边 if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Top) != 0) { rect.Y += 2; rect.Height -= 2; } else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Top) != 0) { rect.Y += 1; rect.Height -= 1; } //右边 if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Right) != 0) { rect.Width -= 2; } else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Right) != 0) { rect.Width -= 1; } //下边 if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Bottom) != 0) { rect.Height -= 2; } else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Bottom) != 0) { rect.Height -= 1; } //设置剪切区 this.m_Graphics.SetClip(rect); //绘制宽边框 using (GraphicsPath pathBorder = RenderEngine.CreateGraphicsPath(rect), pathBorderIn = RenderEngine.CreateGraphicsPath(Rectangle.Inflate(rect, -3, -3)), pathTriangle = new GraphicsPath()) { //边框区域 pathBorder.AddPath(pathBorderIn, true); //右上角三角区域 Point[] points = new Point[] { new Point(rect.X + rect.Width - 40, rect.Y), new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + 40) }; pathTriangle.AddPolygon(points); //绘制 using (Brush brush = new SolidBrush(this.CurrentBackColor)) { this.m_Graphics.FillPath(brush, pathBorder); this.m_Graphics.FillPath(brush, pathTriangle); } } //绘制对号 RenderEngine.DrawCheck(this.m_Graphics, new Rectangle(rect.Right - 22, rect.Y + 2, 20, 20), this.CurrentForeColor); }