Procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
if odSelected in State then
begin
ListBox1.Canvas.Brush.Color := clHighlight;
ListBox1.Canvas.Font.Color := clHighlightText;
end else
begin
ListBox1.Canvas.Font.Color := clBlack;
if Odd(Index) then
ListBox1.Canvas.Brush.Color := clMoneyGreen
else
ListBox1.Canvas.Brush.Color := clWindow;
end;
ListBox1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2,
ListBox1.Items[Index]);
end;
//Mude a propriedade Style para lbOwnerDrawFixed
Listbox zebrado
Listbox zebrado para ajudar na estetica dos formularios
Confira outros conteúdos:
Instalando o ACBr
Mapeamento Objeto-Relacional com TMS...
Introdução aos componentes JEDI
Por
Diogenes
Em 2011