Chitika

Tuesday, January 17, 2012

ListView detail view image in column

Set OwnerDraw=true;
Override DrawSubItem and DrawHeader
DrawHeader implement as  e.DrawDefault=true

DrawSubItem implementation as:

            if (e.ColumnIndex == 1)
            {
                e.DrawDefault = false;
                e.DrawBackground();
                int index = e.Item.ImageIndex;
                Image img = imgLstWallHBState.Images[index];
                e.Graphics.DrawImage(img, e.Bounds.Location);
            }
            else
            {
                e.DrawDefault = true;
            }

No comments:

Post a Comment