string class handling.... aligment etc...
-
hi. I need to concut a string in C# so that it will be aligned to the left. for example: dd/mm/yyy message1 line dd/mm/yyy message222 line dd/mm/yyy message566455 line etc... note: it's not possible here but the intention was for all the "line"s to be one on top of the other.... Thanks....
-
hi. I need to concut a string in C# so that it will be aligned to the left. for example: dd/mm/yyy message1 line dd/mm/yyy message222 line dd/mm/yyy message566455 line etc... note: it's not possible here but the intention was for all the "line"s to be one on top of the other.... Thanks....
:confused: strings are aligned to the left (at least if you write from left to right). if you are painting to the screen, it may help to choose a "non-proportional" font, such as "Courier New" so all characters have the same width; maybe you want a DateTime format that applies leading zeroes, and you might show your message number using a fixed number of digits: num.ToString("000000") will generate at least 6 characters, using leading zeroes. If you are painting on a Graphics, you can use MeasureString() to get the string width in pixels, and adjust coordinates accordingly (but that would be useful only if you do NOT want to align to the left). Hope this helps. :)
Luc Pattyn [My Articles] [Forum Guidelines]