问题描述
我的表单中有两个独立的区域.左侧为单选按钮、组合框等.标签的右侧,甚至标签中的标签.
I have two separate areas in my form.Left side for radio buttons, combo boxes, etc.Right side for tabs and even tabs within tabs.
对于选择的每个选项卡,我想在左侧显示不同的控件以在该选项卡中使用.我试过使用很多东西,包括焦点、点击等.似乎没有任何东西像我想要的那样工作.尤其是在标签内的标签上.
For each tab selected, I'd like to display different controls on the left side for use in that tab.I've tried using many things, including focus, click, etc. Nothing seems to work the way I intend it to. Especially on the tabs within the tabs.
用户界面的图片位于:http://img43.imageshack.us/img43/7533/scrnshotg.jpg
推荐答案
每当我使用选项卡并需要其他控件更改状态(可见、启用等)时,我都会将选项卡控件的选定选项卡索引与集合结合使用各种各样的.已经有一段时间了,但如果我没记错的话,我在顶部有选项卡,当我选择时,会更改多行文本框输入源.
Whenever I use tabs and require other controls to change state (visible, enabled, etc.), I have used the tabcontrol's selected tab index in combination with a collection of sorts. It's been a while, but if I remember correctly I had tabs on a top portion that when I selected, would change the multiline textbox input source.
// this will give you a key to associate with a tab index
Dictionary <int, Panel> subPanels = new Dictionary <int, Panel> ();
然后只需抓取您选择的页面的索引:
Then just grab the index of the page you selected:
int panelIndex;
/* pseudo
OnTabClicked (sender, info)
{
subPanels[panelIndex].Visible = false;
panelIndex = info.Index;
subPanels[panelIndex]Visible = true;
}
*/
我非常有信心这样的事情对你有用.可能需要对您的具体用途进行一些调整,但它应该能让您朝着正确的方向前进.
I'm pretty confident something like this would work for you. It may take some tweaking for your exact use, but it should get you going the right direction.
这篇关于管理选项卡及其效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!