不显示\t制表符的WinForms标签Text属性 [英] Winforms Label Text property not displaying \t tab character

查看:133
本文介绍了不显示\t制表符的WinForms标签Text属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该是很简单的。

我有我的窗体上的Label控件,我试图把文本

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

Label.Text = "Is there a\ttab";



输出为有ATAB;

The output is "Is there atab";

我在做什么错了?

推荐答案

标签实际上是一个非打印字符或者更确切地说,控制字符。它所做的是完全依赖于应用程序。究竟你有什么期望? 8位? 4个空格?由于许多空格作为需要去8列的倍数? ?一个厘米以下文本缩进

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.

这篇关于不显示\t制表符的WinForms标签Text属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆