如何在WizardControl下更改线条的颜色?

时间:2014-10-09 08:25:47

标签: c# winforms devexpress

是否可以在DevExpress WizardControl(WizardAero)中设置Next和Cancel按钮上方的颜色?我无法弄明白该怎么做。

1 个答案:

答案 0 :(得分:1)

AFAIK这条线(分隔线)是使用皮肤图像绘制的,因此无法直接覆盖这些线条的颜色。
但是,您可以使用以下方法覆盖分隔符绘制:

public class MyWizardControl : WizardControl {
    protected override WizardPainter CreatePainter() {
        return new MyWizardPainter();
    }
}
public class MyWizardPainter : WizardPainter {
    protected override WizardClientPainterBase CreateClientPainter(WizardViewInfo viewInfo) {
        return new MyWizardAeroClientPainter(viewInfo);
    }
}
public class MyWizardAeroClientPainter : WizardAeroClientPainter {
    public MyWizardAeroClientPainter(WizardViewInfo viewInfo) : base(viewInfo) { }
    protected override void DrawDividers(GraphicsInfoArgs e) {
        base.DrawDividers(e);
        int bottom = ViewInfo.GetContentBounds().Bottom;
        e.Graphics.DrawLine(Pens.White, ClientRect.Left, bottom, ClientRect.Right, bottom);
        e.Graphics.DrawLine(Pens.LightPink, ClientRect.Left, bottom + 1, ClientRect.Right, bottom + 1);
    }
}

<强>结果:
Wizard with Pink Divider