protected override void OnResize(EventArgs e) { base.Width = (base.Height - 2) * 2; this.diameter = base.Width / 2; this.artis = (4f * this.diameter) * 30f; this.rect = new CustomRectangle(2f * this.diameter, this.diameter + 2f, this.diameter / 2f, 1f, 1f); this.circle = new RectangleF(!this.isON ? 1f : ((base.Width - this.diameter) - 1f), 1f, this.diameter, this.diameter); base.OnResize(e); }
public ToggleButton() { this.Cursor = Cursors.Hand; this.DoubleBuffered = true; this.artis = 4f; this.diameter = 30f; this.textEnabled = true; this.rect = new CustomRectangle(2f * this.diameter, this.diameter + 2f, this.diameter / 2f, 1f, 1f); this.circle = new RectangleF(1f, 1f, this.diameter, this.diameter); this.isON = false; this.borderColor = Color.LightGray; this.painTicker.Tick += new EventHandler(this.paintTicker_Tick); this.painTicker.Interval = 1; this.OnCol = Color.FromArgb(94, 148, 255); this.OffCol = Color.DarkGray; this.ForeColor = Color.White; this.OnTex = "ON"; this.OffTex = "OFF"; }