Search code examples
.netdelphi-prism

Duplicate Case Item: "0"


Could someone please tell me what is exactly wrong with the way my case statement is written. I can't see anything wrong with it, but the compiler keeps raising the following error, "Duplicate case item: '0'," for the line with HatchSytle.Horizontal. If I comment out that line it is fine and compiles without any error.

As you can see, none of the elements I am checking on are the same. So, I shouldn't get any error. Correct me if I am wrong.

    case TMakerGraphic(obj).theBrushStyle of
    HatchStyle.Min: BrushStyleCombo.SelectedIndex := 1;
    HatchStyle.ZigZag: BrushStyleCombo.SelectedIndex := 0;
    HatchStyle.BackwardDiagonal: BrushStyleCombo.SelectedIndex := 2;
    HatchStyle.ForwardDiagonal: BrushStyleCombo.SelectedIndex := 3;
    HatchStyle.Cross: BrushStyleCombo.SelectedIndex := 4;
    HatchStyle.DiagonalCross: BrushStyleCombo.SelectedIndex := 5;
    HatchStyle.Horizontal: BrushStyleCombo.SelectedIndex := 6;  <<<< Line raising error.
    HatchStyle.Vertical: BrushStyleCombo.SelectedIndex := 7;
    end;

Thanks


Solution

  • http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.hatchstyle.aspx

    Check the docs for horizontal and min. they refer to the same enumeration item.