简体   繁体   English

如何设置等于文本框的标签,每个字母都放在单独的行上?

[英]How to set a label equal to a textbox, with every letter on a separate line?

So I have this label, textbox and button, all in this in the Connect Four game that I'm programming. 所以我有这个标签,文本框和按钮,所有这些都在我正在编程的“连接四人”游戏中。

My goal is to have the player enter their name in the textbox, then click the button, and have the label equal the word in the textbox, but with each letter of the word being on a different line in the label. 我的目标是让玩家在文本框中输入其名称,然后单击按钮,并使标签与文本框中的单词相同,但单词的每个字母均位于标签的不同行上。

So how do I do this? 那么我该怎么做呢?

Something like this? 像这样吗

        label1.Text = String.Empty;

        foreach (char c in textBox1.Text)
        {
            label1.Text += c + Environment.NewLine;
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM