-
May 5th, 2009, 02:55 AM
#1
Listview: draw or set icon/s in subitem
I have a problem using LVIF_IMAGE as a mask to the subitem, the icon is drawn but the icon's transparency is disregarded, that is there is a square around the icon when it is being drawn. And I would like to be able to draw multiple icons in the same subitem and apparently LVIF_IMAGE will not be able to do that.
I have been searching for other means and learned that I could ownerdraw the subitem like the following. But the problem now is that only the first column is being selected when I click on a row even if FullRowSelect is true.
Code:
private void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
if (e.ColumnIndex == 1)
{
e.DrawBackground();
e.Graphics.DrawImage(imageList1.Images[1], e.SubItem.Bounds.Location);
e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), e.SubItem.Bounds.Location.X + this.imageList1.Images[0].Width, e.SubItem.Bounds.Location.Y);
}
else
e.DrawDefault = true;
}
private void listView1_DrawColumnHeader_1(object sender, DrawListViewColumnHeaderEventArgs e)
{
e.DrawDefault = true;
}
I just want to be able to set or draw icons to a subitem, I hope someone here could help me out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|