HICON 类型怎么转成 GDI+中的 Image类型?

f26511314 2004-10-13 04:49:28
HICON hIcon=:: ExtractIcon(AfxGetInstanceHandle(),m_strPath,0);
取得可执行文件的图标

我想用gdi+来把hIcon画出来

Graphics graphics(memDC.m_hDC);
Image image(hIcon);////////////////////////////////这里怎样转化
UINT width = image.GetWidth();
UINT height = image.GetHeight();
graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
graphics.DrawImage(
&image,
Rect(0, 0, 42, 42),
0, 0,
width, height,
UnitPixel);
...全文
315 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
roger_ding 2004-10-13
  • 打赏
  • 举报
回复
Bitmap不是有个函数吗,参考MSDN

Bitmap::FromHICON(hicon)
The FromHICON method creates a Bitmap object based on a handle to an icon.
f26511314 2004-10-13
  • 打赏
  • 举报
回复
to : lixiaosan(小三)

谢谢

现在我的问题是:提取可执行文件的图标,DrawIcon
画到DC中,用StretchBlt放大,然后保存成bmp文件,
但是经过放大以后图形失真的厉害,
所以想用GDI+将读出来的图标放大,然后再保存
lixiaosan 2004-10-13
  • 打赏
  • 举报
回复
CDC::DrawIcon
This method draws an icon on the device represented by the CDC object.

BOOL DrawIcon(
int x,
int y,
HICON hIcon );

BOOL DrawIcon(
POINT point,
HICON hIcon );

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧