public static void RenderBorder(Graphics g, Rectangle rect, Color borderColor, ButtonBorderType borderType, int radius, RoundStyle roundType) { rect.Width--; rect.Height--; bool simpleRect = (borderType == ButtonBorderType.Rectangle && (roundType == RoundStyle.None || radius < 2)); SmoothingMode newMode = simpleRect ? SmoothingMode.HighSpeed : SmoothingMode.AntiAlias; using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, newMode)) { using (Pen p = new Pen(borderColor)) { if (simpleRect) { g.DrawRectangle(p, rect); } else if (borderType == ButtonBorderType.Ellipse) { g.DrawEllipse(p, rect); } else { using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, radius, roundType, false)) { g.DrawPath(p, path); } } } } }
private void SetDefaultValue() { InnerPaddingWidth = 0; MiddleButtonOutterSpace1 = 1; MiddleButtonOutterSpace2 = 0; SideButtonLength = 16; BestUndirectLen = 15; DrawBackground = true; DrawBorder = false; DrawInnerBorder = false; ShowSideButtons = true; //SideButtonCanDisabled = false; BackColor = Color.FromArgb(227, 227, 227); BorderColor = Color.FromArgb(248, 248, 248); SideButtonForePathSize = new Size(10, 9); SideButtonForePathGetter = new ButtonForePathGetter( Gdu.WinFormUI.MyGraphics.GraphicsPathHelper.Create7x4DownTriangleFlag); SideButtonColorTable = SideBtnColor(); MiddleButtonColorTable = MdlBtnColor(); HowSideButtonForePathDraw = ForePathRenderMode.Draw; DrawLinesInMiddleButton = true; MiddleBtnLineOutterSpace1 = 4; MiddleBtnLineOutterSpace2 = 4; MiddleButtonLine1Color = Color.FromArgb(89, 89, 89); MiddleButtonLine2Color = Color.FromArgb(182, 182, 182); SideButtonRadius = MiddleButtonRadius = 0; SideButtonBorderType = ButtonBorderType.Rectangle; }
public static void RenderFlatBackground(Graphics g, Rectangle rect, Color backColor, ButtonBorderType borderType, int radius, RoundStyle roundType) { SmoothingMode newMode; bool simpleRect = (borderType == ButtonBorderType.Rectangle && (roundType == RoundStyle.None || radius < 2)); if (simpleRect) { newMode = SmoothingMode.HighSpeed; } else { newMode = SmoothingMode.AntiAlias; rect.Width--; rect.Height--; } using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, newMode)) { using (SolidBrush sb = new SolidBrush(backColor)) { if (simpleRect) { g.FillRectangle(sb, rect); } else if (borderType == ButtonBorderType.Ellipse) { g.FillEllipse(sb, rect); } else { using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, radius, roundType, false)) { g.FillPath(sb, path); } } } } }
public static void RenderFlatBackground(Graphics g, Rectangle rect, Color backColor, ButtonBorderType borderType) { RenderFlatBackground(g, rect, backColor, borderType, 0, RoundStyle.None); }
public static void RenderBorder(Graphics g, Rectangle rect, Color borderColor, ButtonBorderType borderType) { RenderBorder(g, rect, borderColor, borderType, 0, RoundStyle.None); }