WinForms DataGridView Alternative

I need to fill out a 3-column list.

First: the icon. Second: line. Third: line.

I started connecting to the DataGridView, and it seems very large and powerful for my needs. I am not interested in displaying data in a grid like a spreadsheet, and I do not require all the functions that are included in this control. Is there a better alternative?

Thank!

+3
source share
2 answers

You can find the ListView in View. Details , since this is similar to the view you see in Windows Explorer when it is displayed as information.

ImageList ListView imageList1 listView1 . :

listView1.Columns.Add("Image");
listView1.Columns.Add("Text1");
listView1.Columns.Add("Text2");

listView1.SmallImageList = imageList1;

var icon = Icon.ExtractAssociatedIcon(@"c:\windows\explorer.exe");
imageList1.Images.Add(icon);
var item = new ListViewItem();
item.ImageIndex = 0;

var subItem1 = new ListViewItem.ListViewSubItem();
subItem1.Text = "Text 1";
var subItem2 = new ListViewItem.ListViewSubItem();
subItem2.Text = "Text 2";

item.SubItems.Add(subItem1);
item.SubItems.Add(subItem2);

listView1.Items.Add(item);

, , , , , , ListView .

+4
+1

Source: https://habr.com/ru/post/1761724/


All Articles