loaded resources looks ugly

Posted by Xaver on Stack Overflow See other posts from Stack Overflow or by Xaver
Published on 2010-04-14T03:46:15Z Indexed on 2010/04/14 3:53 UTC
Read the original article Hit count: 371

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?

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about visual-c++