|
안녕하세요. heredity입니다.
답변 내용이 부실(?)한 것 같아 사용 예를 올립니다.
행복하세요.
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State)
{
TCanvas *pCanvas = StringGrid1->Canvas;
if( State.Contains( gdFocused ) ) { // Focused Cell인 경우
pCanvas->Brush->Color = clRed;
pCanvas->Font->Color = clWhite;
}
else if( State.Contains( gdSelected ) ) { // 블럭 설정된 Cell들
pCanvas->Brush->Color = clBlack;
pCanvas->Font->Color = clWhite;
}
else { // 그 외의 Cell들
pCanvas->Brush->Color = clWhite;
pCanvas->Font->Color = clBlack;
}
int nLeft = Rect.Left + 2;
int nTop = Rect.Top + (Rect.Height() - pCanvas->TextHeight( "Hy" )) / 2;
pCanvas->TextRect( Rect, nLeft, nTop, StringGrid1->Cells[ACol][ARow] );
// pCanvas->DrawFocusRect( Rect );
}
evergreen 님이 쓰신 글 :
: StringGrid의 글자색은 Font의 Color로 변경할 수 있습니다.
: SG1->Canvas->Font->Color를 바꿔 보세요.
:
: 막막한초보 님이 쓰신 글 :
: : ManagerMain->SG1->Canvas->Brush->Color = clRed;
: : ManagerMain->SG1->Canvas->Pen->Color = clWhite;
: : ManagerMain->SG1->Canvas->FillRect(ManagerMain->SG1->CellRect(nCol,nRow));
: : ManagerMain->SG1->Canvas->TextRect(ManagerMain->SG1->CellRect(nCol,nRow),5,5,ConTxt);
: :
: : 이렇게 했는데요... 글씨가 안보여요..
: : 그 셀의 색만 빨강색으로 변하고... 글씨는 안보이네요...
: : 어떻게 해야 하죠... 쩝..
|