if(ACol < strngrd_Fare->FixedCols || ARow < strngrd_Fare->FixedRows)
//固定Cell与一般Cell颜色不同
strngrd_Fare->Canvas->Brush->Color = clBtnFace;
else
strngrd_Fare->Canvas->Brush->Color = clWhite;
strngrd_Fare->Canvas->Brush->Style = bsSolid;
strngrd_Fare->Canvas->FillRect(Rect);
//调用GDI函数,来使Text居中显示
::DrawText(strngrd_Fare->Canvas->Handle,strngrd_Fare->Cells[ACol][ARow].c_str(),
strngrd_Fare->Cells[ACol][ARow].Length(),&Rect,DT_CENTER | DT_SINGLELINE | DT_VCENTER);
TStringgrid 单元格文字居中代码
最新推荐文章于 2023-05-23 10:45:09 发布