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
[28689] Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 어떻게해야되나요
하늘누리 [changsoon] 931 읽음    2004-02-03 13:26
아래와 같이 코딩을 하였는데 에러 생겼어요
도와주세요

__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
   CheckListBox1->Style=lbOwnerDrawFixed;
   CheckListBox1->Clear();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::CheckListBox1ClickCheck(TObject *Sender)
{
    CheckListBox1->Invalidate();

}
//---------------------------------------------------------------------------
void __fastcall TForm1::CheckListBox1DrawItem(TWinControl *Control,
      int Index, TRect &Rect, TOwnerDrawState State)
{

    Graphics::TBitmap *pBitmap=new Graphics::TBitmap;
    int     Offset = 2;
    TCanvas *pCanvas = ((TListBox *)Control)->Canvas;

    pCanvas->FillRect(Rect);
    pBitmap = (Graphics::TBitmap *)((TListBox *)Control)->Items->Objects[Index];

    if (pBitmap)
    {
      pCanvas->BrushCopy(Bounds(Rect.Left + Offset, Rect.Top, pBitmap->Width, pBitmap->Height),
         pBitmap, Bounds(0, 0, pBitmap->Width, pBitmap->Height), clRed);
      Offset += pBitmap->Width + 4;
    }

    if( CheckListBox1->Checked[Index] ) {
      // Checked 상태인 경우 Font 색상을 변경함.
      pCanvas->Font->Color = clRed;
    }
    else {
      // Font 정보를 그대로 유지하기 위하여 아무 처리도 하지 않음.
    }

    pCanvas->TextOut( Rect.Left + Offset, Rect.Top, ((TListBox *)Control)->Items->Strings[Index]);

}
//---------------------------------------------------------------------------


void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
   CheckListBox1->Clear();
   if(ListBox1->Selected[ListBox1->ItemIndex])
   {
      for(int i=0;i<10;i++)
      {
          CheckListBox1->AddItem(AnsiString(i),Application);
      }
   }
}

+ -

관련 글 리스트
28684 CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 어떻게해야되나요 하늘누리 849 2004/02/02
28686     Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 어떻게해야되나요 김용수 1547 2004/02/02
34414         Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 어떻게해야되나요 하늘누리 914 2004/02/02
28689         Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 어떻게해야되나요 하늘누리 931 2004/02/03
28700             Re:Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 ... 김용수 1004 2004/02/03
28708                 Re:Re:Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경하려면 ... 하늘누리 909 2004/02/04
28716                     Re:Re:Re:Re:Re:CheckListBox에서 체크된 아템의 폰트크기와 색을 변경... 김용수 1139 2004/02/06
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.