I want to display one of my icons (.ico files), which are in .resx file. This way it works with images but I can't figure out how to do it with icons. This way it works to display system icon:
System::Drawing::Icon^ officialicon = gcnew System::Drawing::Icon(SystemIcons::Exclamation, 48,48);
IconPictureBox->Image = officialicon->ToBitmap();
But I can't make it work like this:
ResourceManager^ rm = gcnew ResourceManager("Control_Panel.Resource", GetType()->Assembly);
System::Drawing::Icon^ officialicon = gcnew System::Drawing::Icon(rm->GetObject(L"MyIcon"), 48,48);
IconPictureBox->Image = officialicon->ToBitmap();
Do I need some kind of cast from System::Object
to System::Drawing::Icon
?
Cast it to System::Drawing::Icon
:
safe_cast<System::Drawing::Icon^>