Multiline Text In List View

前端 未结 3 1839
抹茶落季
抹茶落季 2021-01-14 03:03

I try to make a winform contains the ListView as Details (ListView1.View = \"Details\") This ListView has 2 SubItems and i need to Wrap String and put it to SubItem .

<
3条回答
  •  逝去的感伤
    2021-01-14 03:08

    You can implement something like this

    ListView lv = new ListView();
    lv.Columns.Add("Header", 100);
    lv.Columns.Add("Details", 100);
    lv.Dock = DockStyle.Fill;
    lv.Items.Add(new ListViewItem(new string[] { "Sachin", "Some details" }));
    lv.Items.Add(new ListViewItem(new string[] { "Stats", "More details" }));
    lv.View = View.Details;
    Controls.Add(lv);
    

提交回复
热议问题