string sss = string.Format("{0:d8}", 500); MessageBox.Show(sss); return; 代码如上,自动补齐前面的0 转载于:https://www.cnblogs.com/testsec/p/6096016.html