Checkbox in listview control

后端 未结 8 1683
既然无缘
既然无缘 2020-12-20 13:20

Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated.

I am using visual studio 200

相关标签:
8条回答
  • 2020-12-20 13:23

    Maybe ListView.Checkboxes.

    0 讨论(0)
  • 2020-12-20 13:31

    You can set the the CheckBoxes property to true. In code this can be done like this:

    listView1.CheckBoxes = true;
    
    0 讨论(0)
  • 2020-12-20 13:31

    You can try TreeViewAdv. It is open source and hosted on sourceforge.

    0 讨论(0)
  • 2020-12-20 13:32

    Allan Anderson created a custom control to let you do this. You can find it here: http://www.codeproject.com/KB/list/aa_listview.aspx

    Here's some example code for that control:

    
        GlacialList mylist = new GlacialList();
    
    mylist.Columns.Add( "Column1", 100 ); // this can also be added 
    
             // through the design time support 
    
    mylist.Columns.Add( "Column2", 100 ); 
    mylist.Columns.Add( "Column3", 100 ); 
    mylist.Columns.Add( "Column4", 100 ); 
    
    GLItem item;
    
    item = this.glacialList1.Items.Add( "Atlanta Braves" );
    item.SubItems[1].Text = "8v";
    item.SubItems[2].Text = "Live";
    item.SubItems[2].BackColor = Color.Bisque;
    item.SubItems[3].Text = "MLB.TV"; 
    
    item = this.glacialList1.Items.Add( "Florida Marlins" );
    item.SubItems[1].Text = "";
    item.SubItems[2].Text = "Delayed";
    item.SubItems[2].BackColor = Color.LightCoral;
    item.SubItems[3].Text = "Audio";
    
    
    item.SubItems[1].BackColor = Color.Aqua; // set the background 
    
          // of this particular subitem ONLY
    
    item.UserObject = myownuserobjecttype; // set a private user object
    
    item.Selected = true; // set this item to selected state
    
    item.SubItems[1].Span = 2; // set this sub item to span 2 spaces
    
    
    ArrayList selectedItems = mylist.SelectedItems; 
               // get list of selected items
    
    0 讨论(0)
  • 2020-12-20 13:34

    Why dont you try for XPTable by Mathew Hall

    0 讨论(0)
  • 2020-12-20 13:36

    You could use a grid view instead, as that gives you more fine control of column contents.

    0 讨论(0)
提交回复
热议问题