111,126
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Control C = this.GetNextControl(null, true); // 返回 tabindex=0 的控件
MessageBox.Show(C.Name);
C = this.GetNextControl(C, true); // 返回 tabindex=1 的控件
MessageBox.Show(C.Name);
C = this.GetNextControl(C, true); // 返回 tabindex=2 的控件
MessageBox.Show(C.Name);
}
}
}
int a=-1,b=-1,c=-1;
foreach(Control item in this.Controls){
int d = item.TabIndex;
if(d<a)a=d;
else if(d<b)b=d;
else if(d<c)c=d;
}