使用C#进行制表符控制 [英] Tab control using C#

查看:195
本文介绍了使用C#进行制表符控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我在Tab控件中有一个项目.

我在该标签控件中有三个标签,分别为(First_Tab,Second_Tab,Third_Tab).以同样的形式,我有三个名为(First_Button,Second_Button,Third_Button)的按钮.

我需要,当我单击First_Button时,--->从选项卡控件"中,"First_Tab"将启用,其他"外观为禁用"格式,用户无法在"First_Tab"以外的其他选项卡(2,3个选项卡)中进行任何更改.

当我单击Second_Button时,--->从选项卡控件"中,Second_Tab将启用,其他外观为禁用"格式,用户无法在Second_Tab之外的其他选项卡(1,3个选项卡)中进行任何更改.


当我单击Third_Button时,--->在选项卡控件"中,"Third"将启用,而其他显示为禁用"格式的用户将无法在"Third_Tab"以外的其他选项卡(1,2个选项卡)中进行任何更改.


请给我一些想法.........


[edit]已删除呼喊声-OriginalGriff [/edit]

Dear friends,

I have a project in Tab control.

I have three tabs in that Tab Control named (First_Tab, Second_Tab, Third_Tab). In that same form i have three Buttons named (First_Button, Second_Button, Third_Button).

I need, When i click the First_Button, ---> From the Tab Control, First_Tab will Enable and others looks Disable format user can''t do any change in other tabs (2,3 tabs) except First_Tab.

When i click the Second_Button, ---> From the Tab Control, Second_Tab will Enable and others looks Disable format user can''t do any change in other tabs (1,3 tabs) except Second_Tab.


When i click the Third_Button, ---> From the Tab Control, Third will Enable and others looks Disable format user can''t do any change in other tabs (1,2 tabs) except Third_Tab.


Please give some ideas.........


[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案

做事情的方法真可怕!

如果您的用户以前曾经见过标签页(Windows可能经常使用它们),那么他们希望单击标签来选择页面,而不是标签外的按钮.同样,他们不会期望其他选项卡被禁用.那么,如果您要做的就是以完全不同且令人困惑的方式进行熟悉的工作,那么为什么首先要使用选项卡控件?这对您的应用程序不利,因为这意味着用户必须专门为您学习一种新行为,这与他们使用系统的其余部分形成了鲜明的对比.

相反,如果必须执行此操作,则使用一组面板,并在按下按钮时使相应的面板可见,而其他面板则不可见.

如果您坚持使用此方法,则可以非常容易地设置活动选项卡页面-只需将TabControl.SelectedTab属性设置为适当的TabPage:
What a horrible way to do things!

If your users have met tab pages before (and they probably have, windows uses them a lot) then they will expect to click on a tab to select the page, not a button outside the tab. Equally, they will not expect other tabs to be disabled. So why are you using a tab control in the first place, if all you are going to do is make the familiar work in a totally different and confusing manner? That is bad for you app, because it means that users have to learn a new behaviour specifically for you, and that is in contrast to the rest of their use of the system.

Instead, if you must do this, then use a set of panels, and make the appropriate panel visible when you press your button, the the others invisible.

If you instist on this, you can set the active tab page very easily - just set the TabControl.SelectedTab property to the appropriate TabPage:
tabControl1.SelectedTab = tabPage2;

但是您不能轻易禁用标签页-它们仍然可以通过标签本身单击.因此,您需要在每个标签页上放置一个面板,然后启用或禁用该面板以禁用其内容.

But you can''t easily disable tab pages - they will still be clickable via the tab itself. So you will need to put a panel on each tab page, and enable or disable that to disable it''s contents.


这听起来像是您在创建某种向导 [模型–视图–控制器 [ ^ ].

您可以在数据模型中提供多个视图,并 ASP.NET用户控件 [ ^ ], ^ ]或事件驱动的有限状态机 [
It sounds like you are creating some kind of wizard[^], and haven''t quite figured out that it''s a good idea to separate presentation logic from the datamodel. Have a look at Model–view–controller[^].

You can provide multiple views into your datamodel, and ASP.NET User Controls[^], Windows Form User Control[^], or How to Create a WPF User Control & Use It in a WPF Application ( C# )[^] - depending on the technology you are using - can be displayed as dictated be the state of your program/module.

It does sound like an Event-driven finite-state machine[^] would be useful.

Best regards
Espen Harlinn



请尝试下面的示例,然后您就会明白

使用MultiView的简单ASP.NET选项卡控件控件 [ ^ ]

用于ASP.NET应用程序的标签控件 [
Hi
Please try this examples,then you will get the idea

A Simple ASP.NET Tab Control Using the MultiView control[^]

Tab control for ASP.NET Applications[^]

Thanks
Shiju


这篇关于使用C#进行制表符控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆