0

ここで何が間違っているのかわからない

//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
4

2 に答える 2

5

TShapeTypeandの宣言を見てくださいTBrushStyle

TShapeType = (stRectangle, stSquare, stRoundRect, stRoundSquare, stEllipse, stCircle);

TBrushStyle = (bsSolid, bsClear, bsHorizo​​ntal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);

リストボックス内の項目は、対応する同じ列挙を含む同じ順序である必要があります。

于 2013-02-09T22:05:51.253 に答える