使用选中的listBox

mic*_*eal 0 delphi

你好,我想实现一个算法,使用检查列表框我需要的是使用检查项数据和索引从开始我该怎么办?

Bha*_*rat 9

我不确定你是否想要这个.

你必须使用CheckListBox1.Checked[i]功能

此代码将返回TCheckListBox中的已检查项及其索引.

for I := 0 to CheckListBox1.Items.Count - 1 do
  begin
    if CheckListBox1.Checked[i] then
    begin
      ShowMessage('Item at index ' + IntToStr(i) + ' is selected.' + 
                  'Its value is '+ CheckListBox1.Items.Strings[i]);
    end;
  end;
Run Code Online (Sandbox Code Playgroud)

  • @micheal.如果这是你的正确答案,请接受. (7认同)