如何在按下按钮时动态创建文本框 [英] how to create a textbox dynamically when a button pressed

查看:85
本文介绍了如何在按下按钮时动态创建文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
可以通过示例代码帮助我输出一个动态文本框,当按下按钮时

hi can any 1 help me out with a sample code for getting a textbox dynamically when a button pressed

推荐答案

Windows.Forms:

Windows.Forms:
[C#]
private void CreateMyMultilineTextBox()
 {
    // Create an instance of a TextBox control.
    TextBox textBox1 = new TextBox();

    // Set the Multiline property to true.
    textBox1.Multiline = true;
    // Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical;
    // Allow the RETURN key to be entered in the TextBox control.
    textBox1.AcceptsReturn = true;
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = true;
    // Set WordWrap to True to allow text to wrap to the next line.
    textBox1.WordWrap = true;
    // Set the default text of the control.
    textBox1.Text = "Welcome!";
 }





更多:http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox%28v=vs.71% 29.aspx [ ^ ]


这篇关于如何在按下按钮时动态创建文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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