Delphi专题 ·

Delphi Listbox Accessory图标变换

Delphi Firemonkey中ListboxAccessory图标切换

功能

  • 1、Listbox Accessory图标变换
  • 2、Listitem Detail如果为空,则补选中
  • 3、aCheckmark切换

Delphi Listbox Accessory图标变换 Delphi专题 第1张

procedure TForm1.ListBox1ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
var
  i: Integer;
begin
  for i := 0 to ListBox1.Count - 1 do
  begin
    if (ListBox1.Selected.ItemData.Detail = '') or (ListBox1.ItemIndex < 2) or
      (ListBox1.ListItems[i] <> ListBox1.Selected) then
      ListBox1.ListItems[i].ItemData.Accessory :=
        TListBoxItemData.TAccessory.aNone
    else
      ListBox1.ListItems[i].ItemData.Accessory :=
        TListBoxItemData.TAccessory.aCheckmark;
  end;
  if (ListBox1.ItemIndex < 2) or (ListBox1.Selected.ItemData.Detail = '') then
  begin
    ListBoxItem5.IsSelected := true;
    ListBoxItem5.ItemData.Accessory := TListBoxItemData.TAccessory.aCheckmark;
  end;
end;

相关下载

点击下载

参与评论