在单击事件上创建文本框 [英] Create text box on a click event

查看:69
本文介绍了在单击事件上创建文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据用户请求创建文本框或组合框。我的意思是我现在已经制作了一个按钮,如果任何一个单击它应该出现一个文本框。

how to create textbox or combobox on user request. i mean i have made a button now if any one click on it a textbox should be appear.

推荐答案

private void button1_Click_1(object sender, EventArgs e)
        {
            Button btnAdd = new Button();

            btnAdd.BackColor = Color.Gray;
            btnAdd.Text = "Add";
            btnAdd.Location = new System.Drawing.Point(90, 25+i);
            btnAdd.Size = new System.Drawing.Size(50, 25);
            this.Controls.Add(btnAdd);
            i = i + 10;
        }





如果您创建控件(拖放)并使其可见= false并单击.. 。将其更改为true(可见= true)。



also if you create the control(drag and drop) and make it visible = false and on click...change it into true (visible = true).


在表单上添加Textbox / Combobox在页面上设置可见性为false。在Button Click事件中将可见性设置为true。
Add Textbox/Combobox on form set the visibility false on Page Load.In Button Click event set the visibility to true.


这篇关于在单击事件上创建文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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