ListBox
Como faço para colocar cor na linha de um ListBox no caso na linha 0 e 3 ??
grato.
grato.
Anonymous
Curtidas 0
Respostas
Carnette
14/03/2003
Como faço para colocar cor na linha de um ListBox no caso na linha 0 e 3 ??
grato.
procedure TForm1.ListBox2DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
If Index in [0,3] then
begin
ListBox2.Canvas.Font.Color := clwhite;
ListBox2.Canvas.Brush.Color := clGreen;
end
else
begin
ListBox2.Canvas.Font.Color := clBlack;
ListBox2.Canvas.Brush.Color := clWhite;
end;
ListBox2.Canvas.FillRect(Rect);
ListBox2.Canvas.TextOut(Rect.Left+2,Rect.Top,ListBox2.Items[Index]);
end;
NÃO TE ESQUECE DE COLOCAR A PROPRIEDADE
STYLE = lbOwnerDrawFixed OU lbOwnerDrawVariable
GOSTEI 0