StringGrid换行功能

我是研究僧i 提交于 2019-11-30 20:51:27

StringGrid1.Cells[cCol,cRow] := '测试1'+#13#10+'测试2';

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Area:TRect;
begin
StringGrid1.Canvas.Font.Assign
(StringGrid1.Font);
with StringGrid1,StringGrid1.Canvas do
begin 

FillRect(Rect);
Area:= Rect;
InflateRect(Area, -2, -2);
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_CENTER)//居中

end;
end;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!