gpt4 book ai didi

delphi - TListbox和TCheckListbox的功能代码

转载 作者:行者123 更新时间:2023-12-03 19:04:04 24 4
gpt4 key购买 nike

我想创建一个函数,该函数应作为调用参数来支持TListbox或TChecklistBox

 MyUISupportFunction ( ......  ; aListBox : TObject);


if (aListBox as TObject) is TListBox then (aListBox as TListbox).Items.Clear;
if (aListBox as TObject) is TCHeckListBox then (aListBox as TCheckListbox).Items.Clear;


我想知道我可以编写效率更高的UI(TListBox和TChechecklist Box)上的代码

最佳答案

两者都继承自TCustomListBox

Procedure MyUISupportFunction (aListBox : TCustomListBox);
begin
aListBox.Items.Clear;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
MyUISupportFunction(Listbox1);
MyUISupportFunction(CheckListBox1);
end;

关于delphi - TListbox和TCheckListbox的功能代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15638543/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com