vb.net 如何在 Textblock 中输入制表符?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7078509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 15:39:19  来源:igfitidea点击:

How do you enter a tab character in Textblock?

vb.netsilverlighttabs

提问by Terry

Is it possible to add a tab character into a textblock? It's a textblock in Xaml, but i'm adding the text in code, so it has to be done there. Is there any action like "Environment.NewLine", but for the "Tab" character?

是否可以将制表符添加到文本块中?它是 Xaml 中的文本块,但我正在代码中添加文本,因此必须在那里完成。有没有像“Environment.NewLine”这样的动作,但对于“Tab”字符?

Thanks in advance.

提前致谢。

回答by Martin

You can use the vbTabconstantfrom the Microsoft.VisualBasicnamespace.

您可以使用vbTab常量Microsoft.VisualBasic命名空间。

回答by Matt

Or a more .Net-y way:

或者更.Net-y的方式:

Convert.ToChar(Keys.Tab)

回答by Luminous

You can also use:

您还可以使用:

ControlChars.Tab

回答by m.edmondson

Sure just use:

当然只是使用:

Chr(9)

Example:

例子:

TextBox1.Text = "hey" + Chr(9) + "you"