如何在窗体应用程序中打破一行? [英] How to break a line in window form application?

查看:89
本文介绍了如何在窗体应用程序中打破一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在窗口形式中打破一行..



在按钮单击事件中,我在文本区域和下一次单击中显示文本下一个文字应该以新的一行显示..任何人都可以帮忙吗???





Hi,I want to break a line in window form..

In a button click event i am displaying a text in text area and in the next click the next text should be displayed in a new line..can any one help this???


private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text += textBox1.Text + "\n\n";
            textBox1.Text = "";
        }

推荐答案

重写你的代码

textBox2.Text + = textBox1.Text + \ n \\ n;



as



textBox2.Text + = textBox1.Text + Environment.NewLine;
Rewrite your code
textBox2.Text += textBox1.Text + "\n\n";

as

textBox2.Text += textBox1.Text + Environment.NewLine;


通过使用Environment.newline属性,我们可以得到这个...



By using Environment.newline property we can get this...

private void button1_Click(object sender, EventArgs e)
        {
            //textBox2.Text += textBox1.Text + "\n\n";
            textBox2.Text += textBox1.Text + Environment.NewLine;
            textBox1.Text = "";
        }


这篇关于如何在窗体应用程序中打破一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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