为什么我的listview标题不可见

时间:2014-06-17 15:11:39

标签: c# winforms listview

我的列表视图标题是不可见的。

我的代码:

ColumnHeader header = new ColumnHeader();
header.Text = "Manufacture Name";
header.Width = 150;
listView_manufacture.Columns.Add(header);
listView_manufacture.View = View.Details;
listView_manufacture.CheckBoxes = true;

我的错误在哪里?

1 个答案:

答案 0 :(得分:0)

  
    

使用以下代码或点击此链接:http://www.codeproject.com/Articles/24570/Complete-ListView-in-ASP-NET

  

代码:

    GridView myGridView = new GridView();
    myGridView.AllowsColumnReorder = true; 
    myGridView.ColumnHeaderToolTip = "Employee Information";

    GridViewColumn gvc1 = new GridViewColumn();
    gvc1.DisplayMemberBinding = new Binding("FirstName");
    gvc1.Header = "FirstName";
    gvc1.Width = 100;
    myGridView.Columns.Add(gvc1);
    GridViewColumn gvc2 = new GridViewColumn();
    gvc2.DisplayMemberBinding = new Binding("LastName");
    gvc2.Header = "Last Name";
    gvc2.Width = 100;
    myGridView.Columns.Add(gvc2);
    GridViewColumn gvc3 = new GridViewColumn();
    gvc3.DisplayMemberBinding = new Binding("EmployeeNumber");
    gvc3.Header = "Employee No.";
    gvc3.Width = 100;
    myGridView.Columns.Add(gvc3);

   listView.View = myGridView;