I have the TreeView class using in my project. I use icons for it.First i load icons so:
ImageList^ il = gcnew ImageList();
il->Images->Add(Image::FromFile("DISK.ico"));
il->Images->Add(Image::FromFile("FILE.ico"));
il->Images->Add(Image::FromFile("FOLDER.ico"));
treeView1->ImageList = il;
All was good. But i dont like that if i delete my icons from directory of project. there is error in my project. I decide to add icons in .resx file. Now icons loading look so:
ImageList^ il = gcnew ImageList();
Resources::ResourceManager^ resourceManager = gcnew Resources::ResourceManager ("FilesSaver.Form1", GetType()->Assembly);
Object^ disk = resourceManager->GetObject("DISK");
il->Images->Add(reinterpret_cast<Image^>(disk));
Object^ file = resourceManager->GetObject("FILE");
il->Images->Add(reinterpret_cast<Image^>(file));
Object^ folder = resourceManager->GetObject("FOLDER");
il->Images->Add(reinterpret_cast<Image^>(folder));
treeView1->ImageList = il;
And why icons in the TreeView looks ugly (they look lighter and have a big black border). Why did this happen?