public void Redraw(IDrawer2D drawer) { drawer.DrawRect(FastColour.Black, X, Y, Width, Height); if (Value) { DrawTextArgs args = new DrawTextArgs("X", font, false); Size size = drawer.MeasureSize(ref args); args.SkipPartsCheck = true; drawer.DrawText(ref args, X + (Width + 2 - size.Width) / 2, // account for border Y + (Height - size.Height) / 2); } drawer.DrawRectBounds(FastColour.White, 2, X, Y, Width, Height); }
public override void Redraw(IDrawer2D drawer) { if (Window.Minimised || !Visible) { return; } Rectangle rect = new Rectangle(X, Y, Width, Height / 2); using (FastBitmap bmp = Window.LockBits()) { Gradient.Vertical(bmp, rect, boxTop, boxBottom); rect.Y += rect.Height; Gradient.Vertical(bmp, rect, boxBottom, boxTop); if (Value) { const int size = 12; int x = X + Width / 2 - size / 2; int y = Y + Height / 2 - size / 2; BitmapDrawer.DrawIndexed(indices, palette, size, x, y, bmp); } } drawer.DrawRectBounds(FastColour.Black, 1, X, Y, Width - 1, Height - 1); }