감사합니다. 문제해결하는데 많은 도움이 되였습니다.
빌더초보 님이 쓰신 글 :
: 비슷한 질문이 올라온 적이 있네요.
:
: "아이템이 선택이 되지 않도록" 은 못하는것 같고,
: "아이템이 선택이 되지 않은 것 처럼" 보이게 하는 방법입니다.
:
: ListBox의 Style 속성을 lbOwnerDrawFixed 나 lbOwnerDrawVariable 로 변경한 후,
: OnDrawItem 이벤트를 아래와 같이 하세요.
:
:
: //---------------------------------------------------------------------------
: void __fastcall TForm1::ListBox1DrawItem(TWinControl *Control, int Index, TRect &Rect,
: TOwnerDrawState State)
: {
:
: TListBox *AListBox=(TListBox*)Control;
: // eliminate artifacts
: AListBox->Canvas->Pen->Color=AListBox->Color;
: AListBox->Canvas->FillRect(Rect);
:
: // check to see if Index is our "disabled" item
: if (ListBox1_ItemEnabled[Index] == false)
: {
:
: // gray out it's text
: AListBox->Canvas->Font->Color = clGray;
:
: // white out the selection rectangle
: if (State.Contains(odSelected))
: {
: AListBox->Canvas->Brush->Color = AListBox->Color;
: AListBox->Canvas->FillRect(Rect);
: }
:
: }
: else AListBox->Canvas->Font->Color = clBlack;
:
: AListBox->Canvas->TextOut(Rect.Left, Rect.Top, AListBox->Items->Strings[Index]);
:
: }
: //---------------------------------------------------------------------------
:
:
: 여기서 ListBox1_ItemEnabled 는 bool 형 vector로,
: ListBox1과 따라다니면서 Item 이 변할 때마다 같이 변경 해야 됩니다.
:
:
:
: 출처 : http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_qna&no=71419
:
:
:
:
:
:
:
: 초심자3 님이 쓰신 글 :
: : ListBox에 20개 정도의 item들이 있다면 이중에서 2번째 item이선택이 되지 않도록 하고 싶습니다.
: :
: : 이게 가능할까요? 방법을 아신느 분은 알려주세요...
: :
: : (삭제가 아닌 항목은 그대로이지만 선택만 안되게 하는 것입니다.)
|