请问 上面的图片里 ListView里那个 是 可不可以 点一下就实现 成否? 

解决方案 »

  1.   

    //ListViewOnClick事件
    begin
      if ListView.Selected<>nil then
      begin
        if LIstView.Selected.subItem[0]='是' then
          ListView.Selected.subItem[0]:='否'
        else
          ListView.Selected.subItem[0]:='是';  
      end;end;
      

  2.   

    to argl521   是否合法那   不好使啊
      

  3.   

    procedure TForm1.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      vListItem: TListItem;
      vWidth: Integer;
      i: Integer;
    begin
      ListView1.ReadOnly := True;
      ListView1.RowSelect := True;
      case Button of
       mbLeft:
       begin
         vListItem := listview1.GetItemAt(x,y);
         if vListItem = nil then
          Exit;
         vWidth := 0;
         for i := 0 to ListView1.Columns.Count - 1 do
         begin
           if (x >= vWidth) and (x < vWidth + ListView1.Column[i].Width) then
            if (i > 0) and (vListItem.SubItems[i-1] = '是') then
            begin
              vListItem.SubItems[i-1] := '否';
              Exit;
            end;
           Inc(vWidth, ListView1.Column[i].Width);
         end;
       end;
      end;
    end;
      

  4.   

    to zhongme_007  你这个确实很管用但是我不明白他的意识  能否讲讲  什么原理?   让新人也明白点嘛  哈
      

  5.   

    通过判断鼠标点击后弹起的位置来得到ListView.Selected.SubItems