using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _07_3_NowyButton { public class NowyButton : Button { public event EventHandler Click_LU; public event EventHandler Click_LD; public event EventHandler Click_RU; public event EventHandler Click_RD; public NowyButton() { this.MouseClick += NowyButton_MouseClick; } private void NowyButton_MouseClick(object sender, MouseEventArgs e) { if (e.X < this.Width / 2 && e.Y < this.Height / 2) Click_LU?.Invoke(this, e); else if (e.X < this.Width / 2 && e.Y >= this.Height / 2) Click_LD?.Invoke(this, e); else if (e.X >= this.Width / 2 && e.Y < this.Height / 2) Click_RU?.Invoke(this, e); else Click_RD?.Invoke(this, e); } } }