Listbox

Shaitan63
Дата: 15.11.2007 21:06:00
А можно ли в Listbox выделить цветом строку?
L0ader*
Дата: 15.11.2007 22:32:52
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  ListBox1.Canvas.Brush.Style := bsSolid;
  if odSelected in State then
  begin
    ListBox1.Canvas.Brush.Color := $00FFDFDC;

    ListBox1.Canvas.FillRect(Rect);
    ListBox1.Canvas.Brush.Color := $00F5B49C;

    ListBox1.Canvas.FrameRect(Rect);
  end else
  begin
    ListBox1.Canvas.Brush.Color := clWhite;
    ListBox1.Canvas.FillRect(Rect);
  end;

  Rect.Top := Rect.Top + 2;
  Rect.Left := Rect.Left + 2;

  ListBox1.Canvas.Brush.Style := bsClear;

  ListBox1.Canvas.Font.Color := clBlack;
  DrawText(ListBox1.Canvas.Handle, PChar(ListBox1.Items[Index]),
           Length(ListBox1.Items[Index]), Rect, 0);
  //if index = listbox1.Count -1 then
  //   mxStatusBar1.Panels.Items[0].Text := IntToStr(listbox1.Count);
end;
Shaitan63
Дата: 15.11.2007 22:50:36
При многом благодарен.