
Button
dobegin
Top:=ARect.Top+1
Width:=ARect.Right-ARect.Left+1
Height:=ARect.Bottom-ARect.Top+1
Visible:=True
SetFocus
end
试试这个能不能实现,通过自画的方式在单元格内画出文字控件使用-StringGrid多行显示超长文字void__fastcallTForm1::StringGrid1DrawCell(TObject*Sender,intACol,intARow,TRect&Rect,TGridDrawStateState){TRectARect//paintcellrangeARect=StringGrid1->CellRect(ACol,ARow)AnsiStringCurrStr=StringGrid1->Cells[ACol][ARow]if(CurrStr.Length()Canvas->Brush->Color=clRed//SettingCellcolor//StringGrid1->Canvas->FillRect(ARect)//StringGrid1->Canvas->Font->Color=clBlack//SettingCellContentsFontColorStringGrid1->Canvas->TextRect(ARect,ARect.Left+2,ARect.Top+2,StringGrid1->Cells[ACol][ARow])}else{//StringGrid1->Canvas->Brush->Color=clWhite//StringGrid1->Canvas->FillRect(ARect)//StringGrid1->Canvas->Font->Color=clBlackStringGrid1->Canvas->TextOut(ARect.Left+2,ARect.Top+2,StringGrid1->Cells[ACol][ARow].SubString(1,10))StringGrid1->Canvas->TextOut(ARect.Left+2,ARect.Top+17,StringGrid1->Cells[ACol][ARow].SubString(11,20))}}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)