private void btnPrint_Click(object sender, EventArgs e)//按钮btnPring事件
{
string s = "";
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= i; j++)
{
s +=string.Format("{0,1}×{1,1}={2,-4}",j,i,j*1);//-4表示占4个字符的空间,并以左对齐的方式排列
}
s += "\r\n";//换行
}
txtTable.Text = s;//输出到TextBox控件的text属性中
} |