|
짱!!! 님이 쓰신 글 :
: 제가 원하는 색을 주고 싶으면.. DrawCell에서 캔버스를 이용하면 되나요?
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
try
{
Variant vFieldVal = Column->Field->Value;
if (State.Contains(Grids::gdSelected)) {//선택된 행
DBGrid1->Canvas->Brush->Color = clBlack;
DBGrid1->Canvas->FillRect(Rect);
DBGrid1->Canvas->Font->Color = clWhite;
}
else { //선택되지 않은 행
DBGrid1->Canvas->Brush->Color = clWhite;
DBGrid1->Canvas->FillRect(Rect);
DBGrid1->Canvas->Font->Color = clBlack;
}
DBGrid1->Canvas->TextOut(Rect.Left + 2, Rect.Top + 2, vFieldVal);
}
catch (...) {
return;
}
}
이런식으로 하면 선택된 레코드의 색깔을 줄수가 있고 또 칼럼별로 색깔을 줄수가 있습니다..
도움이 되시길.....
|