ListBox - usando o addobject |
Top Previous Next |
|
procedure TForm1.FormCreate(Sender: TObject); begin //Preenche a listbox com as cores Listbox1.Items.AddObject('Azul', TObject($FF0000)); Listbox1.Items.AddObject('Verde', TObject($00FF00)); Listbox1.Items.AddObject('Vermelho', TObject($0000FF)); Listbox1.Items.AddObject('Preto', TObject($000000)); Listbox1.Items.AddObject('Cinza', TObject($C0C0C0)); end;
procedure TForm1.ListBox1Click(Sender: TObject); begin Color := TColor(Listbox1.Items.Objects[Listbox1.ItemIndex]); end; |