ListBox
14/03/2003
0
Como faço para colocar cor na linha de um ListBox no caso na linha 0 e 3 ??
grato.
grato.
Anonymous
Curtir tópico
+ 0
Responder
Posts
14/03/2003
Carnette
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
Responder
Clique aqui para fazer login e interagir na Comunidade :)