public static void DrawSymbol(Graphics g, Rectangle bounds, SystemButtonType type) { Bitmap bitmap = null; switch (type) { case SystemButtonType.Minimize: bitmap = WindowsRetro.Properties.Resources.down_arrow; break; case SystemButtonType.Maximize: bitmap = WindowsRetro.Properties.Resources.up_arrow; break; case SystemButtonType.Menu: bitmap = WindowsRetro.Properties.Resources.menu_symbol; break; case SystemButtonType.UpArrowScrollBar: bitmap = WindowsRetro.Properties.Resources.up_arrow_1; break; case SystemButtonType.DownArrowScrollBar: bitmap = WindowsRetro.Properties.Resources.down_arrow_1; break; } g.DrawOffsetImage(bounds.Location, bitmap, (bounds.Width - bitmap.Width) / 2, (bounds.Height - bitmap.Height) / 2); }
/// <summary> /// Ctor: take parent (form) and button type. /// </summary> /// <param name="owner"></param> public ZenSystemButton(ZenTabbedForm owner, SystemButtonType btnType) : base(owner) { this.btnType = btnType; if (btnType == SystemButtonType.Close) LogicalSize = ZenParams.CloseBtnLogicalSize; else LogicalSize = ZenParams.OtherSysBtnLogicalSize; lineWidth = (int)(2F * Scale); }
/// <summary> /// Ctor: take parent (form) and button type. /// </summary> /// <param name="owner"></param> public ZenSystemButton(ZenTabbedForm owner, SystemButtonType btnType) : base(owner) { this.btnType = btnType; if (btnType == SystemButtonType.Close) { LogicalSize = ZenParams.CloseBtnLogicalSize; } else { LogicalSize = ZenParams.OtherSysBtnLogicalSize; } lineWidth = (int)(2F * Scale); }
public static void DrawSystemButton(Graphics g, Rectangle bounds, SystemButtonType type, ButtonState buttonState) { g.DrawOffsetRectangle(bounds.Location, blackPen, 0, 0, bounds.Width - 1, bounds.Height - 1); switch (type) { case SystemButtonType.Menu: break; default: switch (buttonState) { case ButtonState.Normal: g.DrawOffsetLine(bounds.Location, whitePen, 1, 1, bounds.Width - 2, 1); g.DrawOffsetLine(bounds.Location, whitePen, 1, 1, 1, bounds.Height - 2); g.DrawOffsetLine(bounds.Location, pen1, 2, bounds.Height - 3, bounds.Width - 2, bounds.Height - 3); g.DrawOffsetLine(bounds.Location, pen1, 1, bounds.Height - 2, bounds.Width - 2, bounds.Height - 2); g.DrawOffsetLine(bounds.Location, pen1, bounds.Width - 3, 2, bounds.Width - 3, bounds.Height - 2); g.DrawOffsetLine(bounds.Location, pen1, bounds.Width - 2, 1, bounds.Width - 2, bounds.Height - 2); g.FillOffsetRectangle(bounds.Location, brush4, 2, 2, bounds.Width - 5, bounds.Height - 5); break; case ButtonState.Pushed: g.DrawLine(pen1, 1, 1, bounds.X - 2, 1); g.DrawLine(pen1, 1, 1, 1, bounds.Y - 2); g.FillRectangle(brush4, new Rectangle(2, 2, bounds.X - 3, bounds.Y - 3)); break; } if (type != SystemButtonType.Base) { DrawSymbol(g, bounds, type); } break; } }