标签:begin end Column cxgrid 2cxGrid 动态创建 1cxgrid cdsPowerPrj
//1cxgrid动态创建列
procedure TFrmRuleEdit.CreateCols;
var
Column: TcxGridDBColumn;
begin
cdsPowerPrj.First;
while not cdsPowerPrj.Eof do
begin
Column := viewPower.CreateColumn;
Column.Caption := cdsPowerPrj.FieldByName('description').Text;
Column.DataBinding.FieldName := cdsPowerPrj.FieldByName('powerName').Text;
Column.PropertiesClassName := 'TcxCheckBoxProperties';
Column.Width := 50;
cdsPowerPrj.Next;
end;
end;
//2cxGrid 通过字段名取得列
Column := cxGrdPayOrdVwd.GetColumnByFieldName(FieldName);
//3cxGrid动态创建的列里动态创建事件的方法
procedure TForm1.cxButton1Click(Sender: TObject);
begin
//设置第3列为按钮属性:
cxGrid1DBTableView1.Columns[3].PropertiesClass:=TcxButtonEditProperties;
//关联点击事件:
(cxGrid1DBTableView1.Columns[3].Properties as TcxButtonEditProperties).OnButtonClick
:=cxGrid1DBTableView1ColumnPropertiesButtonClick;
end;
转自https://www.cnblogs.com/Thenext/p/14062263.html
标签:begin,
end,
Column,
cxgrid,
2cxGrid,
动态创建,
1cxgrid,
cdsPowerPrj
From: https://www.cnblogs.com/ynmsnc/p/18361540