private void RenderBackgroundInternal(Graphics g , Rectangle ClientRectangle , BrushParameter backStyle , BrushParameter bordStyle , Ants.Controls.RoundStyle RoundStyle , int Radius) { #region 画背景 if (backStyle.Color2 == Color.Empty || backStyle.Color2 == backStyle.Color1) { using (SolidBrush brush = new SolidBrush(backStyle.Color1)) { using (GraphicsPath path = GraphicsPathHelper.CreatePath(ClientRectangle, Radius, RoundStyle, true)) { g.FillPath(brush, path); } } } else { using (LinearGradientBrush brush = new LinearGradientBrush( ClientRectangle, backStyle.Color1, backStyle.Color2, backStyle.Mode)) { using (GraphicsPath path = GraphicsPathHelper.CreatePath(ClientRectangle, Radius, RoundStyle, true)) { g.FillPath(brush, path); } } } #endregion #region 画边框 using (GraphicsPath path = GraphicsPathHelper.CreatePath(ClientRectangle, Radius, RoundStyle, true)) { using (Pen pen = new Pen(bordStyle.Color1)) { g.DrawPath(pen, path); } } if (bordStyle.Color2 != Color.Empty) { ClientRectangle.Inflate(-1, -1); Rectangle r = ClientRectangle; r.X += 1; r.Y += 1; r.Width -= 2; r.Height -= 2; using (GraphicsPath path = //GraphicsPathHelper.CreatePath(ClientRectangle, Radius, RoundStyle, false)) GraphicsPathHelper.CreatePath(ClientRectangle, Radius, RoundStyle, true)) { using (Pen pen = new Pen(bordStyle.Color2)) { g.DrawPath(pen, path); } } } #endregion }