示例#1
0
 protected override void OnResize(EventArgs e)
 {
     Width    = (Height - 2) * 2;
     diameter = Width / 2;
     artis    = 4 * diameter / 30;
     rect     = new RoundedRectangleF(2 * diameter, diameter + 2, diameter / 2, 1, 1);
     circle   = new RectangleF(!isOn ? 1 : Width - diameter - 1, 1, diameter, diameter);
     base.OnResize(e);
 }
示例#2
0
        public SwitchApple()
        {
            Cursor         = Cursors.Hand;
            DoubleBuffered = true;

            artis       = 4; //increment for sliding animation
            diameter    = 30;
            textEnabled = true;
            rect        = new RoundedRectangleF(2 * diameter, diameter + 2, diameter / 2, 1, 1);
            circle      = new RectangleF(1, 1, diameter, diameter);
            isOn        = true;
            borderColor = Color.LightGray;

            paintTicker.Tick    += paintTicker_Tick;
            paintTicker.Interval = 1;
        }