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
[9750] Re:Re:Re:[질문]ListView OwnerDarw 질문.
방태윤 [nabty] 1574 읽음    2001-08-10 09:23
TListItem 의 메서드
Windows::TRect __fastcall DisplayRect(TDisplayCode Code);
를 이용하십시요.

ListView 의 오우너드로우에 대한 예제가 헬프엔 없던데
TreeView 에는 조금 나와 있습니다.비슷한거 같던데 그걸 참고해 보십시요
아래는 트리뷰example

void __fastcall TCustomDrawForm::TVCustomDrawItem(TCustomTreeView *Sender, TTreeNode *Node, TCustomDrawState State, bool &DefaultDraw)
{
  TRect NodeRect;
  //If DefaultDraw it is true, any of the node's font properties can be
  //changed. Note also that when DefaultDraw is true, Windows draws the
  //buttons and ignores our font background colors, using instead the
  //TreeView's Color property.
  if (State.Contains(cdsSelected))
  {
    TV->Canvas->Font->Assign(SelectedFontDialog->Font);

    TV->Canvas->Brush->Color = SelBkgColorDialog->Color;
  }
  DefaultDraw = FDefaultDrawItem;
  //DefaultDraw = False means you have to handle all the item drawing yourself,
  //including the buttons, lines, images, and text.

  if (!DefaultDraw)

  {
    //draw the selection rect.
    if (State.Contains(cdsSelected))
    {
      NodeRect = Node->DisplayRect(true);
      TV->Canvas->FillRect(NodeRect);
    }

    NodeRect = Node->DisplayRect(false);

    if (None1->Checked)

    {
      //no bitmap, so paint in the background color.
      TV->Canvas->Brush->Color = BkgColorDialog->Color;
      TV->Canvas->Brush->Style = FBrushStyle;
      TV->Canvas->FillRect(NodeRect)
    }
    else  //don't paint over the background bitmap.

      TV->Canvas->Brush->Style = bsClear;

    NodeRect->Left = NodeRect->Left + (Node->Level * TV->Indent);

    //NodeRect.Left now represents the left-most portion of the expand button

    TV->Canvas->DrawButton(NodeRect, Node);

    NodeRect->Left = NodeRect->Left + TV->Indent + FButtonSize;

    //NodeRect.Left is now the leftmost portion of the image.

    TV->Canvas->DrawImage(NodeRect, Node->ImageIndex);

    NodeRect->Left = NodeRect->Left + ImageList->Width;

    //Now we are finally in a position to draw the text.

    TV->Canvas->TextOut(NodeRect->Left, NodeRect->Top, Node->Text);

  }
}

김병은 님이 쓰신 글 :
: 방태윤 님이 쓰신 글 :
: : OwnerDraw = true 에 상관없이
: : CustomDrawItem 이벤트는 발생됩니다.
: :
: CustomDrawItem 은 Rect가 없습니다.
: 전 Rect가 필요합니다.
:
: 왜 OwnerDraw = true를 해도 OnDrawItem 이벤트가 발생하지 않는 걸까요.
:
:
:

+ -

관련 글 리스트
9734 [질문]ListView OwnerDarw 질문. 김병은 1011 2001/08/09
9775     Re:[질문]ListView OwnerDarw 질문. 박지훈.임프 1591 2001/08/10
9780         Re:Re:[질문]ListView OwnerDarw 질문. 수야 1789 2001/08/10
9738     Re:[질문]ListView OwnerDarw 질문. 방태윤 1030 2001/08/09
9743         Re:Re:[질문]ListView OwnerDarw 질문. 김병은 922 2001/08/09
9750             Re:Re:Re:[질문]ListView OwnerDarw 질문. 방태윤 1574 2001/08/10
10100                 답변 감사합니다만 도무지 이해가 안 되어서.DB에 대한 질의문도 없고 다시한번 도와주세요. 정기원 1002 2001/08/21
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.