码迷,mamicode.com
首页 > 其他好文 > 详细

DrawGrid DrawFocusRect

时间:2015-03-16 21:07:54      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

http://docwiki.embarcadero.com/CodeExamples/XE7/en/GridLineWidth_%28C%2B%2B%29

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if (DrawGrid1->DefaultColWidth > 90)
    DrawGrid1->GridLineWidth = 2;
  else
    DrawGrid1->GridLineWidth = 1;
}
 
void __fastcall TForm1::DrawGrid1DrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect,
          TGridDrawState State)
{
  int index = ARow * DrawGrid1->ColCount + ACol;
  DrawGrid1->Canvas->Brush->Color = clBackground;
  DrawGrid1->Canvas->FillRect(Rect);
  ImageList1->Draw(DrawGrid1->Canvas, Rect.Left, Rect.Top, index, True);
  if (State.Contains(gdFocused))
  {
    DrawGrid1->Canvas->DrawFocusRect(Rect);
  }
}
 
void __fastcall TForm1::DrawGrid1SelectCell(TObject *Sender, int ACol, int ARow, bool &CanSelect)
 
{
  CanSelect = True;
}

 

DrawGrid DrawFocusRect

标签:

原文地址:http://www.cnblogs.com/cb168/p/4342802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!