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 MyRectangle(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 Toggle_Switch() { this.Cursor = Cursors.Hand; this.DoubleBuffered = true; this.artis = 4F; this.diameter = 30F; this.textEnabled = true; this.rect = new MyRectangle(2F * this.diameter, this.diameter + 2F, this.diameter / 2F, 1F, 2F); 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"; }