在Messagebox中创建一个新行? *让我解释一下我在问什么“ [英] Create a new line in a Messagebox? *Let me explain what I'm asking"
问题描述
您知道我们如何拥有一个名为MessageBox的对象吗?我一直试图开辟新的路线。例如,当您在记事本程序中按Enter键时,闪烁的行会下降一个?
这是我正在尝试做的事情(用简单的英语) :
1. 这是我要问的一个例子
2. 这是一个例子
我要问的是什么
您会看到示例1如何在一行中。我怎样才能将句子的某一部分放在下面一行?如例2中所示?
You know how we have an object called a MessageBox? I've been trying to make a new line. For example when you press enter in a notepad program, the blinking line goes down one?
Here's what I'm trying to do (in plain English):
1. This is an example of what I'm asking
2. This is an example
of what I'm asking
You see how example 1. is all in one line. How can I break up the line to put a certain portion of the sentence one line below? Like in example 2?
推荐答案
正如Kornfeld所提到的,你所需要的只是输出中的\ n。
As Kornfeld mentioned, all you need is a "\n" in your output.
只需在中间添加Newline;)
Just add Newline in the middle ;)
string.Format("{0}\n{1}",textInFirstLine, textInSecondLine);
或
or
string.Format("{0}{1}{2}",textInFirstLine, Enviroment.NewLine, textInSecondLine);
干杯!
Cheers!
这篇关于在Messagebox中创建一个新行? *让我解释一下我在问什么“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!