|
제 답변은 아니지만...
You can set the StringGrid's DefaultDrawing property to false, then render the
contents of the grid yourself in a handler for the OnDrawCell event. In this
case, simply ignore (i.e., don't render) the selected state. Here's an
example...
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, long Col, long Row,
TRect &Rect, TGridDrawState State)
{
// fixed rows/cols
if (State.Contains(gdFixed))
{
StringGrid1->Canvas->Brush->Color = clBtnFace;
StringGrid1->Canvas->Font->Color = clWindowText;
StringGrid1->Canvas->FillRect(Rect);
Frame3D(StringGrid1->Canvas, Rect, clBtnHighlight,
clBtnShadow, 1);
}
// normal
else
{
StringGrid1->Canvas->Brush->Color = StringGrid1->Color;
StringGrid1->Canvas->Font->Color = StringGrid1->Font->Color;
StringGrid1->Canvas->FillRect(Rect);
}
AnsiString text = StringGrid1->Cells[Col][Row];
StringGrid1->Canvas->TextRect(Rect, Rect.Left, Rect.Top, text);
}
Alternatively, the following may work...
// TForm::OnShow event handler:
void __fastcall TForm1::FormShow(TObject *Sender)
{
StringGrid1->EditorMode = true;
}
Good luck!
--
Damon Chandler
신중원 님이 쓰신 글 :
: 빌더 배운지 2주 됐습니다! ㅠ.ㅠ
: 막히는 부분이 많네요! 좀 도와 주세요!
:
: TStringGrid에서 최초 프로그램이 실행 될때... 첫번째 셀에 파란색으로 나타나네요!
: 포커스가 해당 TStringGrid에 놓여지면 사라졌다가...
: 다시 다른 TStringGrid로 옮겨 가면 다시 생깁니다!
: (하나의 폼에 TStringGrid가 3개 거던요!)
: 원래 이런건가요?
: 아님 옵션이 따로 있나요? 없애는 방법이 있으면 좀 알려 주세요!
:
:
:
: 그리고...하나더..
: TStringGrid의 특정한 Cell의 색을 변경하고 싶습니다!
:
: TRect TheRect;
: TheRect = SG_CFS->CellRect(1,1);
:
: SG_CFS->Canvas->Brush->Color = clRed;
: SG_CFS->Canvas->TextRect(TheRect,TheRect.Left+2,TheRect.Top+2,SG_CFS->Cells[1][1]);
:
: 테스트로 작성 해 봤는데...전혀 안 먹히네요!
: 누가 확실한 방법좀 알려 주세요!
:
: 그럼.....^^
|