如何使用 C# 中组合框中的不同选项创建要显示和隐藏的动态面板?
我想制作一个动态的 GUI,这意味着 GUI 将根据用户在组合框中所做的选择而改变。
例如,如果组合框由{英语、西班牙语、法语}组成,则组合框底部的面板将根据选择更改其描述语言。
为此,我相信我必须执行诸如清除面板然后重绘面板之类的操作,但我不知道该怎么做。
有人能详细告诉我如何在 Visual Studio 2005 C# 上实现这一点吗?
先感谢您。
I want to make a GUI which is dynamic, meaning that the GUI will change depending on the choice which user makes on the combo box.
For example, if combo box consists of {English, Spanish, French}, the panel on the bottom of the combo box will change its description language depending on the choice.
To do this, I believe I have to do something like clear panel then redraw panel, but I have no idea how.
Can someone tell me how to make this happen in details on Visual Studio 2005 C#?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这里有这个确切的实现: http://nbug.codeplex.com/ SourceControl/changeset/view/6081#107027 它实现了 IPanelLoader(对于我的情况是 ISubmitPanel)接口,并加载与组合框中具有相同名称的任何面板。基本上下载源代码并编译它并查看“Configurator”项目。有很多事情需要我花很多篇幅来解释,但已经有一个完整的例子了。
就我而言,任何实现 ISubmitPanel 接口的表单(在我的情况下为 MailForm、FtpForm 等)都可以像这样加载:
当然,此代码应该在您想要将其他表单加载到的另一个表单中运行。
编辑:源代码来自 NBug 项目。
I have this exact implementation right here: http://nbug.codeplex.com/SourceControl/changeset/view/6081#107027 which implements an IPanelLoader (ISubmitPanel for my case) interface and loads any panel with the same name of that in a combo box. Basically download the source code and compile it and have a look at the "Configurator" project. There are a lot of things which would take me pages to explain but there is already a full blown example.
In my case, any form implementing the
ISubmitPanel
interface (MailForm, FtpForm etc. in my case) can be loaded like this:Ofcourse this code should run in another form where you want to load the other form into.
Edit: The source code is from NBug project.