进来看看 一个窗体上有5个文本框,33个按钮的text 分别是1 到33,现在要点击按钮,在文本框中显示text,每个文本框接收6个按钮的text后,焦点就自动转入下个文本框或用鼠标点也行,(暂不接受键盘输入),怎么实现?另33个按钮做成数组怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //参考如下代码 public partial class Form1 : Form { public TextBox[] TextBoxs = new TextBox[5]; public Button[] Buttons = new Button[33]; public int TextBoxIndex = 0; public int AppendCount = 0; public Form1() { InitializeComponent(); for (int i = 0; i < TextBoxs.Length; i++) { TextBoxs[i] = new TextBox(); TextBoxs[i].Left = i * 100; TextBoxs[i].Parent = this; } for (int i = 0; i < Buttons.Length; i++) { Buttons[i] = new Button(); Buttons[i].Top = (i % 10) * 22 + 30; Buttons[i].Left = (i / 10) * 80; Buttons[i].Text = i.ToString(); Buttons[i].Parent = this; Buttons[i].Click += button1_Click; } } private void button1_Click(object sender, EventArgs e) { if (AppendCount >= 5) { TextBoxIndex = (TextBoxIndex + 1) % TextBoxs.Length; AppendCount = 0; } AppendCount++; TextBoxs[TextBoxIndex].SelectedText = ((Button)sender).Text; } } C# AutoCAD菜单设置 简单的取数问题 请教 老革命的新问题:自定义控件时,如何改变控件的命名空间位置.环境VS2008 问一个关于 ComboBox 控件的表连接数据绑定问题 C#编写WIn服务的问题 水晶报表问题 急!请问各位高手,怎么用vs2005正确的运行asp格式的文件啊? 请教通过odp.net,获取数据后,中文变乱码 如何获取一个数据库服务器中的所有数据库的列表? 怎么在c# 中,在webform1中点击一个button,弹出webform2 c#2005如何获取网络时间? 怎么遍历所有窗体,并得到他们的标题
public partial class Form1 : Form
{
public TextBox[] TextBoxs = new TextBox[5];
public Button[] Buttons = new Button[33];
public int TextBoxIndex = 0;
public int AppendCount = 0;
public Form1()
{
InitializeComponent();
for (int i = 0; i < TextBoxs.Length; i++)
{
TextBoxs[i] = new TextBox();
TextBoxs[i].Left = i * 100;
TextBoxs[i].Parent = this;
}
for (int i = 0; i < Buttons.Length; i++)
{
Buttons[i] = new Button();
Buttons[i].Top = (i % 10) * 22 + 30;
Buttons[i].Left = (i / 10) * 80;
Buttons[i].Text = i.ToString();
Buttons[i].Parent = this;
Buttons[i].Click += button1_Click;
}
} private void button1_Click(object sender, EventArgs e)
{
if (AppendCount >= 5)
{
TextBoxIndex = (TextBoxIndex + 1) % TextBoxs.Length;
AppendCount = 0;
}
AppendCount++;
TextBoxs[TextBoxIndex].SelectedText = ((Button)sender).Text;
}
}