Domanda

Try to find solution for next - on mouseEnter - show picture on TabControl page and on MouseLeave - clear it. Currently done - just show pic on tab.

There are a lot of question refered to "How to show" picture - this and this or this ant also a lot of others. For this I use next way - add imageList and just show pic on mouseEnter -

private void tabControlPages_MouseEnter(object sender, EventArgs e)
    {
        tabPageAdd.ImageIndex = 0;
    }

For removing - try to read about some methods on MSDN - but have found nothing (maybe not found). As variant think, can put in collection transparent icon and just change it on mouseLeave, but think it's not a perfect solution. If use imageListIcons.Images.Clear(); - it's fully clear ImageList - as and expected.

So, are ther is some solution avaliable for correct way to hide/show icon on tab from tabControl ?

È stato utile?

Soluzione

Just set ImageIndex = -1 to remove the tab icon:

private void tabControlPages_MouseLeave(object sender, EventArgs e)
{
    tabPageAdd.ImageIndex = -1;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top