English 中文(简体)
如何设置分步过程
原标题:How do i setup a step-by-step process

我正在创建一个应用程序,它必须处理一个小公司的构建案例。为了让员工创建一个新的案例,我想让他们经历一个循序渐进的过程。我该如何设置这样的流程?

我试着把它们放在面板上,但这仍然是解决这个问题的一种不那么优雅的方式。

现在我单独隐藏/显示了很多文本框和列表框。有没有更聪明(更正确)的方法将这些分组。或者有人能提出另一种方法吗?我正在c#中构建它。

最佳回答

我在这个场景中使用的最好的方法是为UserControl中的一个步骤创建所有的按钮、文本框等,并为每个步骤做同样的事情,更好地将该步骤特有的所有代码嵌入到该控件本身中。

在窗体上,只保留那些对每个步骤都通用的控件。然后有一个容器控件,如将窗体上的面板作为占位符(这样您就不必担心定位问题。但是,您甚至可以在代码中设置窗体上控件的位置,并直接将其添加到窗体的控件集合中)

然后在第一步中为Fisrt步骤创建一个UserCotrol的新实例,并将第一个UserControl添加到Forms控件集合或容器控件(面板)中,然后在下一步中删除它并用next UserControl替换它。

这样,你就不会一直在内存中拥有所有控件,它们将在需要时创建,在不需要时处理。它的效率很高,而且还隔离了每个步骤,所以每个步骤都有可管理的代码。

问题回答




相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签