小编use*_*023的帖子

在WPF中对齐字符串

我想打印这样的数据:

http://www.csharp-examples.net/align-string-with-spaces/


 -------------------------------
 Bi1l       | Gates      |    51
 EdnA       | Parker     |   114
 JohNny     | Depp       |    44
 -------------------------------

我尝试使用上面的例子,PadRight以及PadLeft更多的长度计算,我总是得到这种类型的输出(我的输出转到a TextBox)


 -------------------------------
 Bill      | Gates      |    51
 Edna       | Parker  |   114
 Johnny       | Depp       |    44
 -------------------------------

对于我的想法,它发生是因为WPF不为每个字符提供固定和相等的块,因此W占用更多的空间i,并使分离看起来很糟糕.

有人可以帮我解决问题吗?

c# string wpf alignment

3
推荐指数
1
解决办法
56
查看次数

标签 统计

alignment ×1

c# ×1

string ×1

wpf ×1