Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add an image button to each item in listview in detail view mode and large icon view mode.

What I have tried:

private void ls_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            e.DrawDefault = false;
        }


private void ls_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
       {
           if (e.ColumnIndex == ls.Columns.Count - 1)
           { ...add image button}
else
           {
               e.DrawDefault = true;
           }

this works for detail view mode, but in large icon mode, ls_DrawSubItem
method didn't get hit.
Posted
Updated 27-Mar-18 1:47am
v2

1 solution

Occurs when the details view of a ListView is drawn and the OwnerDraw property is set to true.

Only the details view has sub-items. If you want to customize the appearance of items in any other view, then you'll need to use the ListView.DrawItem Event[^] instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900