在 C++CLI 中显示来自本地资源的图标
Display icon from the local resources in C++CLI
我想显示我的一个图标(.ico 文件),它位于 .resx 文件中。 This 它处理图像的方式,但我不知道如何处理图标。这样就可以显示系统图标了:
System::Drawing::Icon^ officialicon = gcnew System::Drawing::Icon(SystemIcons::Exclamation, 48,48);
IconPictureBox->Image = officialicon->ToBitmap();
但我不能让它像这样工作:
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();
我需要从 System::Object
到 System::Drawing::Icon
的某种转换吗?
将其转换为 System::Drawing::Icon
:
safe_cast<System::Drawing::Icon^>
我想显示我的一个图标(.ico 文件),它位于 .resx 文件中。 This 它处理图像的方式,但我不知道如何处理图标。这样就可以显示系统图标了:
System::Drawing::Icon^ officialicon = gcnew System::Drawing::Icon(SystemIcons::Exclamation, 48,48);
IconPictureBox->Image = officialicon->ToBitmap();
但我不能让它像这样工作:
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();
我需要从 System::Object
到 System::Drawing::Icon
的某种转换吗?
将其转换为 System::Drawing::Icon
:
safe_cast<System::Drawing::Icon^>