Тема: ListBoxDrawItem
Показать сообщение отдельно
  #1  
Старый 27.03.2010, 05:03
Аватар для ryderx34
ryderx34 ryderx34 вне форума
Активный
 
Регистрация: 22.01.2010
Сообщения: 211
Версия Delphi: 7, 2010
Репутация: 1349
По умолчанию ListBoxDrawItem

пытаюсь раскрасить ListBox:
Код:
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;
  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;
там где if Index=N then итемы перерисовываются в синий цвет, но не перерисовываются обратно. Что делать?
Ответить с цитированием