|
CustomDrawItem 이벤트에서 직접 아이템을 그릴 수 있습니다. DefaultDraw 인자를 false 로 바꾸어 놓으시면, 아이템을 그리지 않고 사용자가 직접 그려야 합니다. 아래는 DefaultDraw 는 true 로 그대로 놓되, 폰트 컬러만 바꾸는 예제입니다.
부모와 그 자식이 3 번째 (Index는 0..1..2 순서) Index의 뿌리면 빨간색으로 바꾸는 예제입니다.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TreeView1CustomDrawItem(TCustomTreeView *Sender,
TTreeNode *Node, TCustomDrawState State, bool &DefaultDraw)
{
TTreeNode *tnParent = Node;
while(tnParent->Parent)
tnParent = tnParent->Parent;
if(tnParent->Index == 2)
Sender->Canvas->Font->Color = clMaroon;
}
//---------------------------------------------------------------------------
blue_sky 님이 쓰신 글 :
: 안녕하세요.
: 이곳에서 많은 도움을 받고 있는 초보입니다.
: 트리뷰에서 특정row만 폰트의 색을 바꾸고 싶은데요...
: 어떻게 해야 하는지 모르겠습니다.
: 방법 좀 알려주세요...
:
|