各位高手,当点击LISTVIEW控件左边的“检测盒”时,怎么样让当前选测的“检测盒”成为当前选中的行。 在线等待。谢谢大家了!

解决方案 »

  1.   

    当把LISTVIEW控件的checkboxes设为真的时候,当在LISTVIEW里增加一行时,在左边就一有一个“小盒子”可以选择的。如:当你把第三行的“小盒子”选择为真时
    listview1.items[2].checked :=true ,我要让listview1.items[2].selected也为真。现在关键是我点击“小盒子”的时候,不如道它是第几行。
      

  2.   

    Item : TListItem;
    procedure TForm1.ListView1Click(Sender: TObject);
    begin
      if Item <> nil then
        if Item.Checked then Item.Selected := True;
    end;procedure TForm1.ListView1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      Item := ListView1.GetItemAt(X,y);
    end;