0

How can I grey-out listview images after a user invokes a mouse click event on that listview item. Further how can the previously selected images remain greyed-out until the form is reopened?

I have created this image list which loads images:

// Create ImageList objects       
ImageList imageList = new ImageList();
imageList.ImageSize = new Size(160, 160);
imageList.ColorDepth = ColorDepth.Depth32Bit;

The images are displayed in a listview:

private void listView_Family_ItemMouseHover(Object sender, ListViewItemMouseHoverEventArgs e)
{
    listView_Family.ShowItemToolTips = true;
}


if (isFamilyLoadedFlag == true)
{
    //here i can change the item color and now i'd like to change the image
    previewFamilyData(selectedFilePath, selectedFileName);
    //change text color
    e.Item.ForeColor = Color.AntiqueWhite;
    e.Item.BackColor = Color.LightGray;
    int imageIndex = e.Item.ImageIndex;                                               
}

So how do I change either the image, opacity/color/alpha or I'd even settle for shrinking the image if this could distinguish it from the images that have not been modified.

  • The simplest solution is to have two versions of the images in two imagelists. To modify the pixels there are many options, from modifying the pixels with SetPixel or, if there are many of them with Lockbits [see here for an example](http://stackoverflow.com/questions/28792723/adding-or-subtracting-color-from-an-image-in-a-picturebox-using-c-sharp/28799612?s=3|0.1783#28799612) to using tricks with transparency and drawimage or even using a [colormatrix](http://docs.rainmeter.net/tips/colormatrix-guide).. – TaW Jul 19 '15 at 11:03
  • U beauty! you didn't solve how to write the code however you did more you opened my mind to the best legal mind expansion. I should have much fun playing with that little algorithm. I didn't find the slow example mentioned to be that slow at all and it's easy to start with. – frankjock halliday Jul 20 '15 at 10:13
  • _I didn't find the slow example mentioned to be that slow_ Inded, 160x160 shouldn't prodce any problems, unless you need to do hundreds in a row.. – TaW Jul 20 '15 at 10:36

0 Answers0