/// <summary> /// やること追加フォーム表示 /// </summary> /// <param name="sender">オブジェクト</param> /// <param name="e">イベント</param> private void AddButton_Click(object sender, EventArgs e) { SentenceForm sentence = new SentenceForm(); sentence.FormClosed += new FormClosedEventHandler(Sentence_FormClosed); sentence.Show(); }
/// <summary> /// やることフォームが閉じたイベント /// </summary> /// <param name="sender">オブジェクト</param> /// <param name="e">イベント</param> private void Sentence_FormClosed(object sender, EventArgs e) { SentenceForm sentence = (SentenceForm)sender; SetPeriod = sentence.SetPeriod.ToShortDateString(); TimeSpan span = new DateTime(sentence.SetPeriod.Year, sentence.SetPeriod.Month, sentence.SetPeriod.Day) - new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); SetLeftDays = span.Days.ToString(); SetText = sentence.SetText; SetDataGridView(SetPeriod, SetLeftDays, SetText); ToDoDataGridView.Refresh(); }
/// <summary> /// やること編集フォーム表示 /// </summary> /// <param name="sender">オブジェクト</param> /// <param name="e">イベント</param> private void EditButton_Click(object sender, EventArgs e) { if (SelectIndex != -1) { SentenceForm sentence = new SentenceForm(); sentence.FormClosed += new FormClosedEventHandler(Sentence_FormClosed); sentence.SetText = ToDoDataGridView.Rows[SelectIndex].Cells[3].Value.ToString(); RowDelete(); sentence.Show(); ToDoDataGridView.Refresh(); } else if (SelectIndex != -1) { MessageBox.Show("選択してください。"); } else { MessageBox.Show("複数編集はできません。"); } }