在 C# 2.0 中创建向导的最佳方法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the best way to create a wizard in C# 2.0?
提问by csjohnst
I have a winforms application where users will be creating stock items, and a time of creation there are a number of different things that need to happen.
我有一个 winforms 应用程序,用户将在其中创建库存项目,并且在创建时需要发生许多不同的事情。
I think the UI for this should probably be a wizard of some kind, but I'm unsure as to the best way to achieve this. I have seen a couple of 3rd party Wizard controls, and I have also seen manual implementations of making panel visible/invisible.
我认为用于此的 UI 可能应该是某种向导,但我不确定实现这一目标的最佳方法。我见过几个 3rd 方向导控件,我还见过使面板可见/不可见的手动实现。
What are the best ways that people have used in the past, that are easy to implement, and also make it easy to add "pages" to the wizard later on if needed?
人们过去使用过的最好的方法是什么,它们易于实现,并且在以后需要时还可以轻松地将“页面”添加到向导中?
采纳答案by urini
Here are a few more resources you should check out:
以下是您应该查看的更多资源:
This DevExpress WinForms control: http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/
A home-grown wizards framework: http://weblogs.asp.net/justin_rogers/articles/60155.aspx
A wizard framework by Shawn Wildermut part of the Chris Sells's Genghis framework: http://www.sellsbrothers.com/tools/genghis/
这个 DevExpress WinForms 控件:http: //www.devexpress.com/Products/NET/Controls/WinForms/Wizard/
一个本土向导框架:http: //weblogs.asp.net/justin_rogers/articles/60155.aspx
Shawn Wildermut 的向导框架是 Chris Sells 的 Genghis 框架的一部分:http: //www.sellsbrothers.com/tools/genghis/
回答by Matt Hamilton
Take a look at this article on MSDNabout "inductive user interfaces". It describes a framework (and provides the code to download) based on UserControls that give you "navigation" within a form. Perfect for designing wizards.
看看MSDN 上关于“感应用户界面”的这篇文章。它描述了一个基于 UserControls 的框架(并提供了要下载的代码),它为您在表单中提供“导航”。非常适合设计向导。
回答by Scott Dorman
The easiest way to create a wizard dialog is to use one of the third-party versions available that handle all of the "hard stuff" (the page navigation, UI framework, etc.) for you. The one I like the most is from Divelements; they have both a WinForms and a WPF version.
创建向导对话框的最简单方法是使用可用的第三方版本之一,为您处理所有“困难的事情”(页面导航、UI 框架等)。我最喜欢的是来自Divelements 的;他们有 WinForms 和 WPF 版本。
回答by David
I know this answer has already been accepted, but I just found a better Wizard control that's free, and of course, since it's on CodeProject, includes the source, so you can modify it if it's not exactly what you want. I'm adding this as an answer for the next person to stumble across this question looking for a good Wizard control.
我知道这个答案已经被接受,但我刚刚找到了一个更好的向导控件,它是免费的,当然,因为它在 CodeProject 上,包含源代码,所以如果它不是你想要的,你可以修改它。我将此添加为下一个偶然发现此问题以寻找良好向导控件的人的答案。
http://www.codeproject.com/KB/miscctrl/DesignTimeWizard.aspx
http://www.codeproject.com/KB/miscctrl/DesignTimeWizard.aspx
回答by sharkin
Use a tab-control inside a form.
在表单内使用选项卡控件。
Change back color to "Control" in all tab-pages.
在所有标签页中将背景颜色更改为“控制”。
Set "appearance" to flat buttons to get rid of the white border-stuff.
将“外观”设置为扁平按钮以去除白色边框。
Hide the tabs by sizing the entire control so that the tabs gets pushed up "under" the title bar of the form. If you need other controls (or banner maybe) above the tab-control, then instead hide the tabs with a panel-control or similar.
通过调整整个控件的大小来隐藏选项卡,以便将选项卡向上推到窗体标题栏的“下方”。如果您需要选项卡控件上方的其他控件(或横幅),请使用面板控件或类似控件隐藏选项卡。
Childplay to code logic for back/next buttons and very easy to extend with new pages.
Childplay 为后退/下一个按钮编写逻辑,并且很容易扩展新页面。