So from your picture-link I assume you are using a WindowsForms project.
Have a look at this runnable example. Don't forget to replace the image paths with valid paths for your system...
This should give you an idea how to use a
System.Windows.Forms.ListView
. But if you want something more flexible I'd use a
System.Windows.Forms.DataGridView
...
[EDIT: AAAHHH the crazy auto-correction making all the capitals!]
using System;
using System.Drawing;
using System.Windows.Forms;
namespace ListViewTest.Forms
{
static class Program
{
[STAThread]
static void Main()
{
Form form = new Form();
ImageList imagelist = new ImageList();
imagelist.Images.Add(new Bitmap(@"C:\Images\ImageOk.png"));
imagelist.Images.Add(new Bitmap(@"C:\Images\ImageAlarm.png"));
ListView listview = new ListView();
listview.Dock = DockStyle.Fill;
listview.View = View.Details;
listview.FullRowSelect = true; ;
listview.SmallImageList = imagelist;
listview.Columns.AddRange(new ColumnHeader[] {
new ColumnHeader { Text = "Server" },
new ColumnHeader { Text = "Connectivity" },
new ColumnHeader { Text = "Status" }
});
listview.Items.AddRange(new ListViewItem[] {
new ListViewItem(new string[] { "CHI_ADM", "HTTP", "OK" }, 0),
new ListViewItem(new string[] { "CHI_DEV", "HTTP", "CRITICAL" }, 1),
new ListViewItem(new string[] { "CHI_USR", "HTTP", "OK" }, 0)
});
form.Controls.Add(listview);
Application.Run(form);
}
}
}