MessageBox
private void button1_Click(object sender, EventArgs e) { string s = "是否要删除以下文件?\n"; for (int i = 0; i < 10;i++ ) { s += i.ToString()+".\n"; } MessageBox.Show(s, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } |
private void button1_Click(object sender, EventArgs e) { int count = 111; string str = "File"; string s = "是否要删除以下文件?\n"; string s1 = ""; if (count < 15) { for (int i = 0; i <= count; i++) { //1.filename s1 += String.Format("{0}.{1}\n", i, str); } s = s1; } string s2 = "是否要删除以下文件?\n"; if (count > 15) { //产生1...10 for (int i = 1; i < 11; i++) { s2 += String.Format("{0,3}.{1}\n", i, str); } s2 += "\n"; s2 += " ...\n"; s2 += "\n"; s2 += s1; //最后一个名称 //s2 += count.ToString() + "." + str; s2 += String.Format("{0,3}.{1}\n", count, str); s = s2; } MessageBox.Show(s, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } |