本文介绍了如何在运行时添加多个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望在运行时,当任何文本框同时离开时,还有一个文本框在它下面,当该文本框离开时,另一个文本框就会出现在它下面,这个过程一直持续到我想要,整个应该在运行时。
i want that at runtime when any textbox get leave at same time one more textbox comes under it and when that textbox get leave another textbox comes under it and this process get continued till i want and whole should be at runtime.
推荐答案
void existingTextBox_LostFocus(object sender, EventArgs e)
{
TextBox existing = sender as TextBox;
if (existing != null)
{
TextBox newTextBox = new TextBox();
newTextBox.LostFocus += new EventHandler(existingTextBox_LostFocus);
newTextBox.Location = new Point(existing.Location.X, existing.Location.Y + 30);
newTextBox.Size = existing.Size;
Controls.Add(newTextBox);
}
}
这篇关于如何在运行时添加多个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!