我正在尝试使用 gdi+ 绘制图标。直接从磁盘加载图标文件时,它可以正常工作,但如果可能的话,我想将图标存储在资源中。有没有一种简单的方法可以做到这一点而不会失去分辨率?
// The image draws and looks exactly how I want it to
Gdiplus::Image indicator(L"\\Indicator.ico");
graphics->DrawImage( &indicator, 7, 7 );
// The image draws, but looks bloated and pixel-y
const HICON hIcon = AfxGetApp()->LoadIcon( IDI_INDICATOR );
if ( hIcon )
{
Gdiplus::Bitmap* bitmap = Gdiplus::Bitmap::FromHICON( hIcon );
graphics->DrawImage( bitmap, 7, 7 );
}