private void button_predict_Click(object sender, EventArgs e) { char[] separator = { ',' }; string[] Prediction = textBox_success.Text.Split(separator); int Temp = 0; int n = Convert.ToInt32(textBox_NewSampleSize.Text); StringBuilder Str = new StringBuilder(); Str.Append(StrManipulation.PadLeftX("次数", ' ', 12)); Str.Append("\t"); Str.Append(StrManipulation.PadLeftX("预测概率值", ' ', 12)); Str.Append("\r\n"); foreach (string EachPred in Prediction) { if (int.TryParse(EachPred, out Temp)) { if (Temp >= 0 && Temp <= n) { Str.Append(StrManipulation.PadLeftX(Temp.ToString(), ' ', 12)); Str.Append("\t"); Str.Append(StrManipulation.PadLeftX(MathV.NumberPolish(Stat.BetaPrediction(Alpha, Beta, n, Temp).ToString()), ' ', 12)); Str.Append("\r\n"); } } } MainForm.S.richTextBox1.AppendText(Str.ToString()); MainForm.S.richTextBox1.Select(); //让RichTextBox获得焦点 MainForm.S.richTextBox1.Select(MainForm.S.richTextBox1.TextLength, 0); //将插入符号置于文本结束处 MainForm.S.richTextBox1.ScrollToCaret(); }