delphi 定义网格面板布局大小样式属性

fiei3ece  于 2023-10-18  发布在  其他
关注(0)|答案(1)|浏览(124)

我试图添加一个标签,按钮,编辑和按钮到一个gridPanelLayout。我不知道如果sizestyle自动将是最好的或不想测试它。我在运行时创建组件。因此,我尝试为每个组件集添加一个新行。但是我不知道如何将SizeStyle的属性设置为auto。我目前有GridpanelLayout1.RowCollection[i].SizeStyle := TsizeStyle.auto,但它给出了错误,TSizeStyle是未声明的。

//add to grid
      gridpanelLayout1.BeginUpdate;

      if i <> 0 then
      begin
      GridpanelLayout1.rowcollection.Add;
      GridpanelLayout1.RowCollection[i].SizeStyle := TsizeStyle.auto
      end;

      GridpanelLayout1.ControlCollection.Add;
      GridpanelLayout1.ControlCollection[i].Column := 0;
      GridpanelLayout1.controlCollection[i].Row := i;
      GridpanelLayout1.ControlCollection[i].Control := (namelabel);

      GridpanelLayout1.ControlCollection.Add;
      GridpanelLayout1.ControlCollection[i].Column := 1;
      GridpanelLayout1.controlCollection[i].Row := i;
      GridpanelLayout1.ControlCollection[i].Control := (minusButton);

      GridpanelLayout1.ControlCollection.Add;
      GridpanelLayout1.ControlCollection[i].Column := 2;
      GridpanelLayout1.controlCollection[i].Row := i;
      GridpanelLayout1.ControlCollection[i].Control := (editfield);

      GridpanelLayout1.ControlCollection.Add;
      GridpanelLayout1.ControlCollection[i].Column := 3;
      GridpanelLayout1.controlCollection[i].Row := i;
      GridpanelLayout1.ControlCollection[i].Control := (Plusbutton);

      GridpanelLayout1.EndUpdate;
7ajki6be

7ajki6be1#

TSizeStyle是在TGridPanelLayout类中声明的类型。
要解决此问题,请将该行更改为

GridpanelLayout1.RowCollection[i].SizeStyle := TGridPanelLayout.TsizeStyle.auto

相关问题