如何使StringGrid组件Cells内容居中与换行?

sjysh 2000-08-07 12:32:00
如何使StringGrid组件Cells内容居中与换行?
急!
...全文
147 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lotto 2000-08-07
  • 打赏
  • 举报
回复
换行是无法实现的.
居中可以写一个过程。
produce Tform1.button1click(sender:objcect);
var i,j:integer;
spaces:string; //空格个数
begin
for i:=0 to stringgrid1.colcount-1
for j:=0 to stringgrid1.rowcount-1
begin
with stringgrid1 do
begin
spaces:=colwidths[i]-canvas.textwidth(trim(cells[i,j]));
if spaces>0 then
begin
spaces:=(spaces div 2) div canvas.font.size
if space>=1 then
cells[i,j]:=replacespace(space)+cells[i,j] //replacespace为产生n个空格字串的函数。

end;
end;
end;
end;
Michaelyfj 2000-08-07
  • 打赏
  • 举报
回复
关注...
sjysh 2000-08-07
  • 打赏
  • 举报
回复
请问,有没有可以实现换行功能的相类似组件?

5,386

社区成员

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

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