먼저 ListBox1에 Style를 lbOwnerDrawFixed로 바꾸세요.
onDrawItem 에 아래와 같이 코딩해 보십시오..
procedure TForm1.ListBox1DrawItem(Sender: TObject; Index: Integer;
Rect: TRect; State: TOwnerDrawState; var Handled: Boolean);
begin
with ListBox1.Canvas do
begin
if (odselected in State) then
begin
Brush.Color := clBtnFace;
Font.Color := clRed;
end;
FillRect(Rect);
TextOut(Rect.Left, Rect.Top , ListBox1.Items[Index]);
end;
end;
그럼 즐코하세요..
jaya 님이 쓰신 글 :
: 선택된 item의 배경색과 폰트색을 바꾸고 싶은데요..
: 어디를 세팅해야할지..
: 아무리 찾아바도 안보이네요..
: 기본적으로 설정된 값은 파랑바타에 흰색 글씨인데 이것을 다른 거로 바꾸고 싶어요..
: 어디서 바꿔야 하나요..
:
:
|