关于StringGrid

lovetsfuer 2014-02-15 05:36:56

StringGrid背景是黑色,方格是白色,能修改成红色的不?
...全文
82 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sololie 2014-02-15
  • 打赏
  • 举报
回复

// 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++));//随便写些字
}


13,825

社区成员

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

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