namespace VaioxOnline { using Microsoft.VisualBasic.CompilerServices; using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; using System.Windows.Forms; internal class FlatStatusBar : Control { private Color _BaseColor = Color.FromArgb(0x2d, 0x2f, 0x31); private Color _RectColor = Helpers._FlatColor; private bool _ShowTimeDate = false; private Color _TextColor = Color.White; private int H; private int W; public FlatStatusBar() { base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); this.DoubleBuffered = true; this.Font = new Font("Segoe UI", 8f); this.ForeColor = Color.White; base.Size = new Size(base.Width, 20); } protected override void CreateHandle() { base.CreateHandle(); this.Dock = DockStyle.Bottom; } public string GetTimeDate() { string[] textArray1 = new string[] { Conversions.ToString(DateTime.Now.Date), " ", Conversions.ToString(DateTime.Now.Hour), ":", Conversions.ToString(DateTime.Now.Minute) }; return string.Concat(textArray1); } protected override void OnPaint(PaintEventArgs e) { Helpers.B = new Bitmap(base.Width, base.Height); Helpers.G = Graphics.FromImage(Helpers.B); this.W = base.Width; this.H = base.Height; Rectangle rect = new Rectangle(0, 0, this.W, this.H); Graphics g = Helpers.G; g.SmoothingMode = SmoothingMode.HighQuality; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; g.Clear(this.BaseColor); g.FillRectangle(new SolidBrush(this.BaseColor), rect); g.DrawString(this.Text, this.Font, Brushes.White, new Rectangle(10, 4, this.W, this.H), Helpers.NearSF); g.FillRectangle(new SolidBrush(this._RectColor), new Rectangle(4, 4, 4, 14)); if (this.ShowTimeDate) { StringFormat format = new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center }; g.DrawString(this.GetTimeDate(), this.Font, new SolidBrush(this._TextColor), new Rectangle(-4, 2, this.W, this.H), format); } 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 OnTextChanged(EventArgs e) { base.OnTextChanged(e); base.Invalidate(); } [Category("Colors")] public Color BaseColor { get => this._BaseColor set { this._BaseColor = value; } } [Category("Colors")] public Color RectColor { get => this._RectColor set { this._RectColor = value; } } public bool ShowTimeDate { get => this._ShowTimeDate set { this._ShowTimeDate = value; } } [Category("Colors")] public Color TextColor { get => this._TextColor set { this._TextColor = value; } } } }