procedure TNetDesignerForm.DeviceListDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
With Listbox1 do begin
case Index mod 2 of
0 : Canvas.Font.Color := clblue ;
1 : Canvas.Font.Color := clblack;
Canvas.FillRect(Rect);
Canvas.TextOut( Rect.Left, Rect.Top, Items.Strings[Index]);
end ; //with
end;
위와 같이 하니까 아이템별로 글자색깔은 바뀌거든요...
근데 아이템별 배경색깔을 바꾸고자 할때는 어떻게 해야 하나요?
좋은 하루 되시구요...
> Index: Integer; Rect: TRect; State: TOwnerDrawState);
> begin
> With Listbox1 do begin
>
> case Index mod 2 of
> 0 : Canvas.Font.Color := clblue ;
> 1 : Canvas.Font.Color := clblack;
>
> Canvas.FillRect(Rect);
> Canvas.TextOut( Rect.Left, Rect.Top, Items.Strings[Index]);
> end ; //with
> end;
참고하세여~
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Canvas.Brush.Color := clBlue;
Form1.Canvas.Font.Color := clRed;
Form1.Canvas.TextOut(10,10, '우하하');
end;