动态创建cxGrid的步骤
public
{ Public declarations }
tvTemp: TcxGridDBTableView;
lTemp: TcxGridLevel;
gdTemp: TcxGrid;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
gdTemp := TcxGrid.Create(self);
lTemp := gdTemp.Levels.Add;
tvTemp := TcxGridDBTableView(gdTemp.CreateView(TcxGridDBTableView));
lTemp.Control := gdTemp;
lTemp.GridView := tvTemp;
gdTemp.ParentWindow := self.Handle;
gdTemp.Top := 0;
gdTemp.Height := 200;
gdTemp.Width := 400;
tvTemp.Preview.Visible := true;
tvTemp.DataController.DataSource := OraDataSource1;
tvTemp.DataController.CreateAllItems;
ShowMessage(tvTemp.Columns[0].Caption);
end;
本文地址:http://www.45fan.com/dnjc/71869.html