I want to print data like this:
http://www.csharp-examples.net/align-string-with-spaces/
------------------------------- Bi1l | Gates | 51 EdnA | Parker | 114 JohNny | Depp | 44 -------------------------------
I tried using the example above, PadRight and PadLeft and more calculations of length, and I always got this type of output (my output goes to a TextBox)
------------------------------- Bill | Gates | 51 Edna | Parker | 114 Johnny | Depp | 44 -------------------------------
For what I think, it happens because WPF doesn't give a fixed and equal block for every character, so W takes more space than i, and makes the separations look bad.
Can someone help me out with a solution?
You can change your font type to Monospace font (Wikipedia) like Courier.
According to the linked wikipedia article other possible font types are Courier New, Lucida Console, Monacoor Consolas.
Alternatively you can change your UI and display your data using some kind of grid control like the DataGrid control to display your data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With