C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[21103] Re:TStringGrid에서 포커스..........
유영인.Chris [cuperido] 1117 읽음    2002-08-30 09:28
제 답변은 아니지만...

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]);
:
: 테스트로 작성 해 봤는데...전혀 안 먹히네요!
: 누가 확실한 방법좀 알려 주세요!
:
: 그럼.....^^

+ -

관련 글 리스트
21084 TStringGrid에서 포커스.......... 신중원 824 2002/08/29
21103     Re:TStringGrid에서 포커스.......... 유영인.Chris 1117 2002/08/30
21110         [RE] 감사합니다! ^^ 신중원 653 2002/08/30
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.