问题
I have Multi Line TextBox (C# 2.0). I want to display some data as follows.
"Contact Person : " + string1 + Environment.NewLine
"Sales Man : " + string2 + Environment.NewLine
"Credit Limit : " + string3 + Environment.NewLine
"Due days : " + string4 + Environment.NewLine
But this code displaying as
Contact Person : Person1
Sales Man : salesman1
Credit Limit : 50000.00
Due days : 20
My problem is I can't align the text. My expected out put,
Contact Person : Person1
Sales Man : salesman1
Credit Limit : 50000.00
Due days : 20
How can I achieve this?
回答1:
You need to change the font used by the textbox to a monospaced (non-proportional) font, like Courier.
回答2:
Set the AcceptsTab property of your textBox to true. Then use '\t' in your textlines to tab to the correct position.
来源:https://stackoverflow.com/questions/1303938/multi-line-textbox-text-alignment-c-2-0