// --------------------------- top of file Button1_Imitated.cs ---------------------------- using System.Windows.Forms; using System.Drawing; using System; public class Button1_Imitated : Panel { // ============== new versions ================ public new string Text; public new Font Font; public new EventHandler Click; // ============================================ bool pushed = false, valid=false; public Button1_Imitated() { MouseMove += (s, e) => { if(pushed && e.X > 0 && e.Y > 0 && e.X < this.Width && e.Y < this.Height) { if (!valid) { valid = true; Invalidate(); } } else if (valid) { valid = false; Invalidate(); } }; } // ========================================================== protected override void OnSizeChanged(EventArgs e) { FontFamily family = base.Font.FontFamily; if (this.Font != null) { family = this.Font.FontFamily; } this.Font = new Font(family, this.Height*3 / 8); } // ========================================================== protected override void OnMouseDown(MouseEventArgs e) { pushed = true; valid = true; Invalidate(); } // ========================================================== protected override void OnMouseUp(MouseEventArgs e) { pushed = false; valid = false; if (e.X>0 && e.Y>0 && e.X