【发布时间】:2015-12-07 06:22:13
【问题描述】:
目前我正在使用这种方法在控制台中将文本居中。
string x = "Whatever I want to print goes here";
Console.SetCursorPosition((Console.WindowWidth - InvalidNo.Length) / 2, Console.CursorTop);
Console.WriteLine(x);
但是我现在需要将看起来像这样的东西居中:
players[PlayerNo].Name + " has stolen a piece of cheese from " + players[choice - 1].Name
类似的东西
"Player {0}", playernum + 1
有什么办法可以用我的方法做到这一点,还是我必须使用不同的方法?
提前致谢。
【问题讨论】:
-
我没有看到那里的方法,只是一个代码 sn-p 甚至无法编译。那么你说的方法从外面看起来怎么样?
-
@Bart:请改进问题以提供尽可能多的信息。如果您是新来的,请先进行实地考察; stackoverflow.com/tour