|
CheckListBox1->AddItem(AnsiString(i),Application);에서 오류 난게 맞나요 ?
오류 난다고만 되어 있어서 어디가 오류 인지..... (두리번 두리번 -_-;;)
CheckListBox1->AddItem(AnsiString(i),Application); 에서 오류가 났다면
AddItem은 TCheckListBox의 Method가 아니기 때문에 나타나는 오류입니다.
즉, 없는 함수를 호출했기 때문이라고 할 수 있죠.
글구 ListBox1Click()에서 하려는 목적이 무엇인지 감이 안 잡히는 군요.
for 문으로 10번을 반복하면서 하는 일도 그렇고....
CheckListBox1를 Clear해서 옮기는 부분과 CheckListBox1의 색상을 변경하는 부분도
논리적으로 연결이 안되고....
행복하세요.
------------------------------------------------------------------
하늘누리 님이 쓰신 글 :
: 아래와 같이 코딩을 하였는데 에러 생겼어요
: 도와주세요
:
: __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);
: }
: }
: }
|