namespace VaioxOnline { using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; using System.Windows.Forms; internal class FlatColorPalette : Control { private Color _Black = Color.FromArgb(0x2d, 0x2f, 0x31); private Color _Blue = Color.FromArgb(0, 0x80, 0xff); private Color _Cyan = Color.FromArgb(10, 0x9a, 0x9d); private Color _Gray = Color.FromArgb(0x3f, 70, 0x49); private Color _LimeGreen = Color.FromArgb(0x23, 0xa8, 0x6d); private Color _Orange = Color.FromArgb(0xfd, 0xb5, 0x3f); private Color _Purple = Color.FromArgb(0x9b, 0x58, 0xb5); private Color _Red = Color.FromArgb(220, 0x55, 0x60); private Color _White = Color.FromArgb(0xf3, 0xf3, 0xf3); private int H; private int W; public FlatColorPalette() { base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); this.DoubleBuffered = true; this.BackColor = Color.FromArgb(60, 70, 0x49); base.Size = new Size(160, 80); this.Font = new Font("Segoe UI", 12f); } protected override void OnPaint(PaintEventArgs e) { Helpers.B = new Bitmap(base.Width, base.Height); Helpers.G = Graphics.FromImage(Helpers.B); this.W = base.Width - 1; this.H = base.Height - 1; Graphics g = Helpers.G; g.SmoothingMode = SmoothingMode.HighQuality; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; g.Clear(this.BackColor); g.FillRectangle(new SolidBrush(this._Red), new Rectangle(0, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Cyan), new Rectangle(20, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Blue), new Rectangle(40, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._LimeGreen), new Rectangle(60, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Orange), new Rectangle(80, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Purple), new Rectangle(100, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Black), new Rectangle(120, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._Gray), new Rectangle(140, 0, 20, 40)); g.FillRectangle(new SolidBrush(this._White), new Rectangle(160, 0, 20, 40)); g.DrawString("Color Palette", this.Font, new SolidBrush(this._White), new Rectangle(0, 0x16, this.W, this.H), Helpers.CenterSF); g = null; base.OnPaint(e); Helpers.G.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled(Helpers.B, 0, 0); Helpers.B.Dispose(); } protected override void OnResize(EventArgs e) { base.OnResize(e); base.Width = 180; base.Height = 80; } [Category("Colors")] public Color Black { get => this._Black set { this._Black = value; } } [Category("Colors")] public Color Blue { get => this._Blue set { this._Blue = value; } } [Category("Colors")] public Color Cyan { get => this._Cyan set { this._Cyan = value; } } [Category("Colors")] public Color Gray { get => this._Gray set { this._Gray = value; } } [Category("Colors")] public Color LimeGreen { get => this._LimeGreen set { this._LimeGreen = value; } } [Category("Colors")] public Color Orange { get => this._Orange set { this._Orange = value; } } [Category("Colors")] public Color Purple { get => this._Purple set { this._Purple = value; } } [Category("Colors")] public Color Red { get => this._Red set { this._Red = value; } } [Category("Colors")] public Color White { get => this._White set { this._White = value; } } } }