创建向导在C#Windows窗体 [英] Creating Wizards for Windows Forms in C#

查看:282
本文介绍了创建向导在C#Windows窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建向导为Windows是新形式的C#.NET应用程序。所以,我没有在向导创建的任何想法。请给我一些想法有关创建多个向导。

I am new in Creating Wizards for Windows Forms Application in C# .Net. So i don't have any idea in wizard creation. Please give me some ideas about creating Multiple wizard.

问候,拉维

推荐答案

办法做到这一点很多。创建每个向导步骤的一种形式是可能的,但很别扭。又丑,很多当用户改变步骤的闪烁。使每一步一个用户控件可以工作,你只需切换并排出窗体的控件集合。或使它们中的一个可见=真每个步骤。在UC设计往往变得错综复杂不过,你必须为每个UI项目添加公共属性。

Lots of ways to do it. Creating a form for each wizard step is possible, but very awkward. And ugly, lots of flickering when the user changes the step. Making each step a UserControl can work, you simply switch them in and out of the form's Controls collection. Or make one of them Visible = true for each step. The UC design tends to get convoluted though, you have to add public properties for each UI item.

的容易和RAD的方法是使用一个TabControl。工作得很好的设计师,因为它可以让你在设计时切换标签拖放每个选项卡上的控件。切换步骤是微不足道的,只是改变SelectedIndex属性。唯一不平凡的是隐藏在运行时的选项卡。仍然很容易通过处理Windows消息的事情。添加一个新类到窗体并粘贴如下所示的code。编译。从工具箱的上方新的控制到您的表单。

The easy and RAD way is to use a TabControl. Works very well in the designer since it allows you to switch tabs at design time and drop controls on each tab. Switching steps is trivial, just change the SelectedIndex property. The only thing non-trivial is to hide the tabs at runtime. Still easy to do by processing a Windows message. Add a new class to your form and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form.

using System;
using System.Windows.Forms;

class WizardPages : TabControl {
  protected override void WndProc(ref Message m) {
    // Hide tabs by trapping the TCM_ADJUSTRECT message
    if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
    else base.WndProc(ref m);
  }
}

这篇关于创建向导在C#Windows窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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