请问StringGrid的多表头的问题

zhongdee 2003-10-16 09:50:21
在StringGrid中的多表头如何显示,我override了DrawCell,可一旦按了 滚动条,就不能正常显示,代码如下:
procedure TCourseGrid.Drawcell(......);
var
rLeft,rRight,rTitle:TRect;
outstr:string;
i:integer;
begin

inherited drawcell(...)
if ACol=0 then
for i:=1 to 7 do
begin
case i of
1:outstr:='字符串一';
2:outstr:='字符串二';
3:outstr:='字符串三';
4:outstr:='字符串四';
5:outstr:='字符串五';
6:outstr:='字符串六';
7:outstr:='字符串日';
end;
rLeft:=Cellrect((i-1)*FDayHourCount+1,0);
rRight:=cellrect(i*FDayHourCount,0);
rTitle.TopLeft:=rLeft.TopLeft;
rTitle.BottomRight:=rRight.BottomRight;
Canvas.FillRect(rTitle);
drawText(Canvas.Handle,pchar(outstr),length(outstr),rTitle,dt_center);
end;
end;
...全文
38 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhongdee 2003-10-16
  • 打赏
  • 举报
回复
在StringGrid中的多表头如何显示,我override了DrawCell,可一旦按了 滚动条,就不能正常显示,代码如下:
procedure TCourseGrid.Drawcell(......);
var
rLeft,rRight,rTitle:TRect;
outstr:string;
i:integer;
begin

inherited drawcell(...)
if ACol=0 then
for i:=1 to 7 do
begin
case i of
1:outstr:='字符串一';
2:outstr:='字符串二';
3:outstr:='字符串三';
4:outstr:='字符串四';
5:outstr:='字符串五';
6:outstr:='字符串六';
7:outstr:='字符串日';
end;
rLeft:=Cellrect((i-1)*4+1,0);
rRight:=cellrect(i*4,0);
rTitle.TopLeft:=rLeft.TopLeft;
rTitle.BottomRight:=rRight.BottomRight;
Canvas.FillRect(rTitle);
drawText(Canvas.Handle,pchar(outstr),length(outstr),rTitle,dt_center);
end;
我想要的表头是两行,上面的一行的一个格子对应下面一行的四个格子,我刚写了上面一行的显示代码,下面一行的还没有写,就发现了问题
end;
dzt1 2003-10-16
  • 打赏
  • 举报
回复
没办法
Tiack 2003-10-16
  • 打赏
  • 举报
回复
你的源码不明确,我无法确定

5,387

社区成员

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

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