private void TglChange(TglSwitch tgl) { if (tgl.Checked == true) { tgl.Checked = false; } else if (tgl.Checked == false) { tgl.Checked = true; } }
private void StopWatch_Load(object sender, EventArgs e) { // InfoButtonについての設定 InfoButton InfoButton = new InfoButton(); EventHandler InfoBtnHandler = new EventHandler(InfoButton_Click); InfoButton.Click += InfoBtnHandler; InfoButton.Location = new Point(335, 9); InfoButton.Size = new Size(27, 27); InfoButton.Cursor = Cursors.Hand; Controls.Add(InfoButton); // トグルスイッチについての設定 TglSw = new TglSwitch(); EventHandler Tgl1Handler = new EventHandler(Tgl_Change); TglSw.Click += Tgl1Handler; TglSw.Location = new Point(10, 12); TglSw.Size = new Size(40, 21); TglSw.Cursor = Cursors.Hand; Controls.Add(TglSw); TglSw.Checked = false; }