private void btn_Start_Click(object sender, EventArgs e) { // 多重クリック回避 timer.Stop(); lab_cntdown.Text = "―"; tick = 0; if (Control.ModifierKeys == Keys.Control) { Coordinater c = new Coordinater(true); c.form = this; c.ShowDialog(); } else if (Control.ModifierKeys == Keys.Shift) { Coordinater c = new Coordinater(false); c.form = this; c.ShowDialog(); } else timer.Start(); // タイマーを開始 }
private void btn_Start_Click(object sender, EventArgs e) { try { var first = int.Parse(tb_X.Text); var second = int.Parse(tb_Y.Text); if (first <= Screen.PrimaryScreen.Bounds.Width && second <= Screen.PrimaryScreen.Bounds.Height) { if (locateMode) { form.X = first; form.Y = second; if (Control.ModifierKeys == Keys.Shift) { Coordinater c = new Coordinater(false); c.form = form; c.ShowDialog(); } else { form.timer.Start(); } } else { form.W = first; form.H = second; form.timer.Start(); } this.Close(); } else { throw new FormatException("入力された値が画面の範囲外です"); } } catch (FormatException ex) { MessageBox.Show("入力の形式が正しくありません。\n(入力漏れ、画面の範囲外の値など)\n\n【エラー詳細】" + ex.Message + "\n【スタックトレース】" + ex.StackTrace, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }