C#中怎么实现点击butten一次增加一个textbox

来源:百度知道 编辑:UC知道 时间:2024/05/25 14:18:45

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication10
{
public partial class Form1 : Form
{
Point p;
public Form1()
{
InitializeComponent();
p=new Point(0,0);
}

private void button1_Click(object sender, EventArgs e)
{
TextBox t = new TextBox();
t.Parent = this;
t.Show();
t.Text = "111";
t.Location = p;
p.Y += 20;
}
}
}

我初略的写了个,反正你就是动态增加 TextBox就OK了 注意设置它的parent和location属性 希望对你有帮助

有很多种方法.

有一个控件. 类似Panel 装控件的. 写好TextBox的代码.再将代码写入这个控件..