Is it possible to insert programmatically a line separator between two rows in a Winform c# ListView ?
Like that for example :
Is it possible to insert programmatically a line separator between two rows in a Winform c# ListView ?
Like that for example :
Going off of the answer provided in the comments above. You need to hook into the DrawItem
event and draw the line at the bottom after whatever item you want is drawn. Here I've drawn a line after item with Text == "2"
is drawn:
private void ListView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
e.DrawDefault = true;
if (e.Item.Text == "2")
{
e.Graphics.DrawLine(Pens.Black, e.Bounds.Left, e.Bounds.Bottom, e.Bounds.Right, e.Bounds.Bottom);
}
}
You may need to draw the line underneath multiple items if more than one item is placed on a row in your ListView
.