不知道我在做什麼錯在這裏枚舉爲整數,反之亦然(使用組合框項目索引)
//update controls from main form Tshape
form2.cbxShape.ItemIndex:= ord(Shape1.Shape);
form2.cbxColor.Selected:= Shape1.Brush.Color;
form2.cbxStyle.ItemIndex:= Ord(Shape1.Brush.Style);
if form2.ShowModal = mrOK then
begin
//update main form Tshape from controls
Shape1.Shape:= TShapeType(form2.cbxShape.ItemIndex);
Shape1.Brush.Color:= form2.cbxColor.Selected;
Shape1.Brush.Style:= TBrushStyle(form2.cbxStyle.ItemIndex);
end;
,我沒有得到正確的形狀或刷子樣式(顏色正常工作)
列表框項目如下:
Circle
Ellipse
Rectangle
RoundRect
RoundSquare
Square
和
BDiagonal
Clear
Cross
DiagCross
FDiagonal
Horizontal
Solid
啊,我把這些值直接從T形性降了下來,似乎他們是按字母順序排序。感謝您的正確方向 – JakeSays 2013-02-09 22:31:11