private void Button_On_Tick(object sender, EventArgs e) { Mouse_x = this.PointToClient(MousePosition).X; Mouse_y = this.PointToClient(MousePosition).Y; if (Button.Top == 0) { Button.Left = Mouse_x; ON.BringToFront(); Button.BringToFront(); ON.Width = Mouse_x; if (Button.Left >= 38) { Button.Left = 38; } if (Button.Left <= 0) { Button.Left = 0; ON.BringToFront(); Off.BringToFront(); Button.BringToFront(); } } else { Button.Top = 0; } }
private void ON_MouseUp(object sender, MouseEventArgs e) { ON.Image = Properties.Resources.处理1; ON.BringToFront(); Off.BringToFront(); Button.BringToFront(); Button.Left = 0; Off.Width = 50; Checked = false; this.OnClick(null); }