可否在StringGrid的一个Cell中显示两行文字

sincostan 2002-06-04 04:25:46
(有这个需求)
回车\n不起作用
...全文
49 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyu 2002-09-26
  • 打赏
  • 举报
回复
good
ppzhao 2002-06-05
  • 打赏
  • 举报
回复
同意楼上的
hhmmdd 2002-06-04
  • 打赏
  • 举报
回复
void __fastcall TMainForm::gridDrawCell(TObject *Sender, int ACol, int ARow,
TRect &Rect, TGridDrawState State)
{
TCanvas *cv = grid->Canvas;
TRect r = Rect; r.left++; r.top++; r.right--; r.bottom--;

String S1,S2,S=grid->Cells[ACol][ARow];
int pos = S.Pos("\n");
if(pos==0) cv->TextRect(r,r.Left+1,r.Top+(r.Height()-cv->TextHeight(S))/2,S);
else {
S1 = S.SubString(1,pos-1);
cv->TextRect(r,r.Left+2,r.Top+1,S1);
S2 = S.SubString(pos+1,S.Length()-pos);
r.top += cv->TextHeight(S1)+2;
cv->TextRect(r,r.Left+1,r.Top,S2);
}

}
mygodness 2002-06-04
  • 打赏
  • 举报
回复
看来不行,我试了用:StringGrid1->Canvas->TextOut(0,0,"string1");也不行

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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