Windows窗体事件“选择选项卡”? [英] Windows Forms event "On Select Tab"?
本文介绍了Windows窗体事件“选择选项卡”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我认为这是 TabControl.SelectedIndexChanged
事件。
只要看看MSDN。我从那里拿走了假设你命名你的tab控件 tabControl1
。
您需要使用以下方式订阅此事件:
tabContrl1.TabControl.SelectedIndexChanged + = tabControl1_SelectedIndexChanged;
添加事件处理程序
private void tabControl1_SelectedIndexChanged(Object sender,EventArgs e){
MessageBox.Show(你在TabControl.SelectedIndexChanged事件中);
}
I'm building a Windows Forms application in C#. How do I trigger code when a certain tab on a tab menu is selected?
解决方案
I think it is the TabControl.SelectedIndexChanged
event.
Just look at MSDN. I took it from there. Suppose you named your tab control tabControl1
.
You need to subscribe to this event using:
tabContrl1.TabControl.SelectedIndexChanged += tabControl1_SelectedIndexChanged;
And add the event handler
private void tabControl1_SelectedIndexChanged(Object sender, EventArgs e) {
MessageBox.Show("You are in the TabControl.SelectedIndexChanged event.");
}
这篇关于Windows窗体事件“选择选项卡”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文