Тема: ListBoxDrawItem
Показать сообщение отдельно
  #2  
Старый 27.03.2010, 06:38
lmikle lmikle вне форума
Модератор
 
Регистрация: 17.04.2008
Сообщения: 8,096
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
По умолчанию

А так:
Код:
procedure TForm1.ListBox2DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  if odSelected in State then
    begin
      ListBox2.Canvas.Brush.Color:=clLime;
      ListBox2.Canvas.Font.Color:=clBlack;
    end 
  Else
  if Index=N then
    begin
      ListBox2.Canvas.Brush.Color:=clBlue;
      ListBox2.Canvas.Font.Color:=clWhite;
    end;
  ListBox2.Canvas.FillRect(Rect);
  ListBox2.Canvas.TextOut(Rect.Left+2,Rect.Top,ListBox2.Items[Index]);
end;
Ответить с цитированием