/// <summary> /// /// </summary> /// <param name="G"></param> /// <param name="Rect"></param> /// <param name="RStyle"></param> /// <param name="Radius"></param> private void DrawBorder( Graphics G, Rectangle Rect, FormRoundStyle RStyle, int Radius) { Rect.Width -= 1; Rect.Height -= 1; using (GraphicsPath path = FormGraphicsPathHelper.CreatePath( Rect, Radius, RStyle, false)) { using (Pen pen = new Pen(ColorTable.BorderColor)) { G.DrawPath(pen, path); } } Rect.Inflate(-1, -1); using (GraphicsPath path = FormGraphicsPathHelper.CreatePath( Rect, Radius, RStyle, false)) { using (Pen pen = new Pen(ColorTable.InnerBorderColor)) { G.DrawPath(pen, path); } } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnRenderSkinFormBackground(SkinFormBackgroundRenderEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ClipRectangle; SkinForm form = e.SkinForm; using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g)) { int bc = int.Parse(this.ColorTable.BaseColor.B.ToString()); int gc = int.Parse(this.ColorTable.BaseColor.G.ToString()); int rc = int.Parse(this.ColorTable.BaseColor.R.ToString()); using (LinearGradientBrush brush = new LinearGradientBrush(rect, this.ColorTable.BaseColor, this.GetUndertoneColor(rc, gc, bc), 90f, true)) { using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(rect, form.Radius, form.RoundStyle, false)) { g.FillPath(brush, path); } } } }
/// <summary> /// /// </summary> /// <param name="SForm"></param> /// <returns></returns> public override Region CreateRegion(SkinForm SForm) { Rectangle rect = new Rectangle(Point.Empty, SForm.Size); using (GraphicsPath path = FormGraphicsPathHelper.CreatePath( rect, SForm.Radius, SForm.RoundStyle, false)) { return(new Region(path)); } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected void OnTabPageBackground(Color BaseColor, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ClipRectangle; using (FormAntiAliasGraphics antiGraphics = new FormAntiAliasGraphics(g)) { int bc = int.Parse(BaseColor.B.ToString()); int gc = int.Parse(BaseColor.G.ToString()); int rc = int.Parse(BaseColor.R.ToString()); using (LinearGradientBrush brush = new LinearGradientBrush(rect, BaseColor, this.GetUndertoneColor(rc, gc, bc), 90f, true)) { using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(rect, 4, FormRoundStyle.All, false)) { g.FillPath(brush, path); } } } }
/// <summary> /// /// </summary> /// <param name="G"></param> /// <param name="Rect"></param> /// <param name="BaseColor"></param> /// <param name="BorderColor"></param> /// <param name="InnerBorderColor"></param> /// <param name="Style"></param> /// <param name="RoundWidth"></param> /// <param name="basePosition"></param> /// <param name="DrawBorder"></param> /// <param name="DrawGlass"></param> /// <param name="Mode"></param> internal static void RenderBackgroundInternal( Graphics G, Rectangle Rect, Color BaseColor, Color BorderColor, Color InnerBorderColor, FormRoundStyle Style, int RoundWidth, float basePosition, bool DrawBorder, bool DrawGlass, LinearGradientMode Mode, System.Windows.Forms.Orientation Orientation) { if (DrawBorder) { Rect.Width--; Rect.Height--; } using (LinearGradientBrush brush = new LinearGradientBrush(Rect, Color.Transparent, Color.Transparent, Mode)) { Color[] colors = new Color[4]; colors[0] = GetColor(BaseColor, 0, 35, 24, 9); colors[1] = GetColor(BaseColor, 0, 13, 8, 3); colors[2] = BaseColor; colors[3] = GetColor(BaseColor, 0, 35, 24, 9); ColorBlend blend = new ColorBlend(); blend.Positions = new float[] { 0.0f, basePosition, basePosition + 0.05f, 1.0f }; blend.Colors = colors; brush.InterpolationColors = blend; if (Style != FormRoundStyle.None) { using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(Rect, RoundWidth, Style, false)) { G.FillPath(brush, path); } if (BaseColor.A > 80) { Rectangle rectTop = Rect; if (Mode == LinearGradientMode.Vertical) { rectTop.Height = (int)(rectTop.Height * basePosition); } else { rectTop.Width = (int)(Rect.Width * basePosition); } using (GraphicsPath pathTop = FormGraphicsPathHelper.CreatePath(rectTop, RoundWidth, FormRoundStyle.Top, false)) { using (SolidBrush brushAlpha = new SolidBrush(Color.FromArgb(128, 255, 255, 255))) { G.FillPath(brushAlpha, pathTop); } } } if (DrawGlass) { RectangleF glassRect = Rect; if (Mode == LinearGradientMode.Vertical) { glassRect.Y = Rect.Y + Rect.Height * basePosition; glassRect.Height = (Rect.Height - Rect.Height * basePosition) * 2; } else { glassRect.X = Rect.X + Rect.Width * basePosition; glassRect.Width = (Rect.Width - Rect.Width * basePosition) * 2; } FormControlPaintEx.DrawGlass(G, glassRect, 170, 0, Orientation); } if (DrawBorder) { using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(Rect, RoundWidth, Style, false)) { using (Pen pen = new Pen(BorderColor)) { G.DrawPath(pen, path); } } Rect.Inflate(-1, -1); using (GraphicsPath path = FormGraphicsPathHelper.CreatePath(Rect, RoundWidth, Style, false)) { using (Pen pen = new Pen(InnerBorderColor)) { G.DrawPath(pen, path); } } } } else { G.FillRectangle(brush, Rect); if (BaseColor.A > 80) { Rectangle rectTop = Rect; if (Mode == LinearGradientMode.Vertical) { rectTop.Height = (int)(rectTop.Height * basePosition); } else { rectTop.Width = (int)(Rect.Width * basePosition); } using (SolidBrush brushAlpha = new SolidBrush(Color.FromArgb(128, 255, 255, 255))) { G.FillRectangle(brushAlpha, rectTop); } } if (DrawGlass) { RectangleF glassRect = Rect; if (Mode == LinearGradientMode.Vertical) { glassRect.Y = Rect.Y + Rect.Height * basePosition; glassRect.Height = (Rect.Height - Rect.Height * basePosition) * 2; } else { glassRect.X = Rect.X + Rect.Width * basePosition; glassRect.Width = (Rect.Width - Rect.Width * basePosition) * 2; } FormControlPaintEx.DrawGlass(G, glassRect, 200, 0, Orientation); } if (DrawBorder) { using (Pen pen = new Pen(BorderColor)) { G.DrawRectangle(pen, Rect); } Rect.Inflate(-1, -1); using (Pen pen = new Pen(InnerBorderColor)) { G.DrawRectangle(pen, Rect); } } } } }