13,825
社区成员
发帖
与我相关
我的任务
分享
// OnDrawCell 事件, strngrd1 是 TStringGrid 控件
void __fastcall TForm1::strngrd1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
strngrd1->DefaultDrawing = False;
strngrd1->Color = clBlack;//注释该行则表格范围外保持原色
TRect r = Rect;
TCanvas* can = strngrd1->Canvas;
r.right += strngrd1->GridLineWidth;
r.Bottom += strngrd1->GridLineWidth;
can->Brush->Color = clRed;
can->FillRect(r);
r.Right -= strngrd1->GridLineWidth;
r.Bottom -= strngrd1->GridLineWidth;
can->Brush->Color = clBlack;
can->FillRect(r);
can->Font->Color = clWhite;
static int d = 100;
can->TextOutA(r.left,r.top,IntToStr(d++));//随便写些字
}