} // ExitBTN END private void OpenFileBTN_Click(object sender, EventArgs e) // 讀檔 Button // { filename = ToFile.ChooseOpenFile(openFileDialog, ""); if (ToFile.check) // 如果成功開檔 { fileReader = ToFile.ReadFile(filename); checkFile = checkFileIsTextOrBinary(fileReader.ReadLine(), ToFile); if (checkFile != -1) { AddDataIntoList(); // 將資料放入LIST Distribution(RecordList); // 分配成績 LevelDistribution(RecordList); // 分配成績 displayTextBox.Text = string.Format("Level Distribution:\r\n\r\nMid-Term Scores:\r\n" + MidTermString + "\r\n\r\nFinal-Term Scores:\r\n" + FinalTermString + "\r\n\r\nNormal-Grade Scores:\r\n" + NormalGradeString); // 顯示在表單上 ChangeColor(); // 改變顏色 // 顯示 // optionBtns[0].Visible = false; ChooseShowModeGroupBox.Visible = true; for (int ButtonIndex = 4; ButtonIndex < optionBtns.Length - 1; ButtonIndex++) { optionBtns[ButtonIndex].Enabled = true; } } } else { MessageBox.Show("Error Reading from File", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // OpenFileBTN END
// 開檔案 按鈕 private void OpenFile_BTN_Click(object sender, EventArgs e) { // 開檔 string filename = ""; filename = ToFile.ChooseOpenFile(openFileDialog, ""); fileReader = ToFile.ReadFile(filename); // 顯示 if (ToFile.check) { checkFile = checkFileIsTextOrBinary(fileReader.ReadLine(), ToFile); fileReader = ToFile.ReadFile(filename); if (checkFile != -1) { Next_BTN.Text = "Start"; OpenFile_BTN.Enabled = false; Next_BTN.Enabled = true; } } } // end OpenFile_BTN_Click
private void OpenFile_BTN_Click(object sender, EventArgs e) { // 開檔 string filename = ToFile.ChooseOpenFile(openFileDialog, ""); fileReader = ToFile.ReadFile(filename); // 顯示 if (ToFile.check) { OpenFile_BTN.Enabled = false; Next_BTN.Enabled = true; ChooseMethodGroupBox.Enabled = false; } } // end OpenFile_BTN_Click