2

我正在使用 Winforms 和 Devexpress 向导控件开发应用程序。虽然我搜索了很多,但我找不到实现step indicator向导的方法(如下图所示)。关于如何实现这样的目标的任何想法?

在此处输入图像描述

4

1 回答 1

1

这是我从DevExpress 表单中得到的。我能够将其实现为用户控件。唯一的缺点是它不是通用的。正如您将看到的,我使用了放置在LineShapefrom上的复选框Visual Basic PowerPacks

以下是逻辑部分的完整代码:

public partial class WizardStepControl : UserControl
{
    public WizardStepControl()
    {
        InitializeComponent();
    }

    public void SetStepCurrent(int step)
    {
        switch (step)
        {
            case 1:
                SetCurrent(step1);

                break;

            case 2:
                SetCurrent(step2);
                break;

            case 3:
                SetCurrent(step3);
                break;
        }
    }

    public void SetStepChecked(int step)
    {
        switch (step)
        {
            case 1:
                SetChecked(step1);
                break;

            case 2:
                SetChecked(step2);
                break;

            case 3:
                SetChecked(step3);
                break;
        }
    }

    public void SetStepNext(int step)
    {
        switch (step)
        {
            case 1:
                SetNext(step1);
                break;

            case 2:
                SetNext(step2);
                break;

            case 3:
                SetNext(step3);
                break;
        }
    }


    private void SetChecked(CheckEdit checkBox)
    {
        checkBox.Enabled = true;
        checkBox.Properties.PictureChecked = Resources.wzd_check;
        checkBox.Properties.PictureUnchecked = Resources.wzd_check;
        checkBox.Properties.PictureGrayed = Resources.wzd_check;

    }

    private void SetNext(CheckEdit checkBox)
    {
        checkBox.Enabled = false;
        checkBox.Properties.PictureChecked = Resources.wzd_next;
        checkBox.Properties.PictureUnchecked = Resources.wzd_next;
        checkBox.Properties.PictureGrayed = Resources.wzd_next;
    }

    private void SetCurrent(CheckEdit checkBox)
    {
        checkBox.Enabled = true;
        checkBox.Properties.PictureChecked = Resources.wzd_current;
        checkBox.Properties.PictureUnchecked = Resources.wzd_current;
        checkBox.Properties.PictureGrayed = Resources.wzd_current;
    }
}

将控件放在向导标题中,它将如下所示:

在此处输入图像描述

于 2013-06-12T13:47:48.480 回答