Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This should be very simple.

I have a Label control on my Form and I am trying to put a tab character between text

Label.Text = "Is there atab";

The output is "Is there atab";

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
408 views
Welcome To Ask or Share your Answers For Others

1 Answer

Tab is actually a non-printing character—or rather, a control character. What it does is entirely dependent on the application. What exactly do you expect? 8 spaces? 4 spaces? As many spaces as needed to get to a multiple of 8 columns? Indentation of the following text by one cm?

To put it short: The Label control doesn't support tabs. Actually, Label just uses normal graphics routines for rendering its text and how should they know what you intend to do with your tab character?

If you need to display that character as a number of spaces, then you should replace it by that number of spaces.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...