我动态创建了一个cxgrid,但不能用,老大们帮忙看看

telstar 2006-10-23 02:45:12
代码如下:
var
aView:TcxGridDBTableView;
begin

FCxGrid := tCxGrid.create(self);
FCxGrid.Parent := self;
FCxGrid.Visible := true;
FCxGrid.left := 100;
FCxGrid.Top := 100;
FCxGrid.Width := 200;
FCxGrid.height := 200;

aView := TcxGridDBTableView(FCxGrid.CreateView(TcxGridDBTableView));
// aview.

with aView do
begin
with createcolumn do
caption := 'abc';

showmessage(Columns[0].Caption);

DataController.DataSource := ds1;
(DataController as IcxCustomGridDataController).DeleteAllItems;
(DataController as IcxCustomGridDataController).CreateAllItems;
showmessage(Columns[0].Caption);

end;

可以用showmessage看到列名
但view没有显示出来,整个GRID都是灰的
项目中急需,在线等......老大们帮忙啊
...全文
262 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
9807146wang 2006-12-15
  • 打赏
  • 举报
回复
有哪位大哥知道怎么用代码指定它的列cxGrid1DBTableView1Column1的Properties为ExtLookupComboBox;(动态指定的那种);多谢了。
slzzg 2006-12-15
  • 打赏
  • 举报
回复
少了一个TcxGridLevel;

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;
SeekMyself 2006-10-23
  • 打赏
  • 举报
回复
tCxGrid.View := aView
skypeople 2006-10-23
  • 打赏
  • 举报
回复
VIEW的某个属性没有设正确,可能是PARENT,VISIBLE之类的东东,试试吧!!

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧