|
OnCustomDrawItem 같은 이벤트 핸들러에서 그리면 될거 같네요..
그냥 아무데서나 캔버스로 그리면 다음번 OnPaint 이벤트에서 그 코드를 안거치고 그냥 그리니까 무시되는거라 볼 수 있죠.
leaderkk 님이 쓰신 글 :
: void __fastcall TMain::ChannelOnOff(TObject *Sender)
: {
: TRect Rect;
:
: for(int i=0; i<ListView_Output->Items->Count; i++){
: if(ListView_Output->Items->Item[i]->Selected == true){
: if(strcmpi(ListView_Output->Items->Item[i]->SubItems->Strings[0].c_str(), "On")==0){
: OutputThread->ulOutputData[i/32] = OutputThread->ulOutputData[i/32]&(~(1<<(i%32)));
: ListView_Output->Items->Item[i]->SubItems->Strings[0] = "Off";
:
: #if 1
: Rect = ListView_Output->Items->Item[i]->DisplayRect(drBounds);
: ListView_Output->Canvas->Brush->Color = clWhite;
: ListView_Output->Canvas->FillRect(Rect);
: #endif
: }
: else{
: OutputThread->ulOutputData[i/32] = OutputThread->ulOutputData[i/32]|(1<<(i%32));
: ListView_Output->Items->Item[i]->SubItems->Strings[0] = "On";
:
: #if 1
: Rect = ListView_Output->Items->Item[i]->DisplayRect(drBounds);
: ListView_Output->Canvas->Brush->Color = clYellow;
: ListView_Output->Canvas->FillRect(Rect);
: #endif
: }
: ListView_Output->Canvas->Font->Size = 8;
: ListView_Output->Canvas->Font->Color = clBlack;
: ListView_Output->Canvas->Font->Name = "굴림";
: }
: }
: }
:
: 위의 코드와 같이 했는데 로우을 선택하면 색깥이 변했다가 다른 로우로 이동하면 원래의 색깔로 변합니다.
:
: 그리고 이벤트는 더블클릭 이벤트입니다.
:
: 즐거운 주말되세요.
|