我做了一个OCX,我想在OCX界面的Static上画一个ICON,却不会画,详情请进 ==>

XunBaian 2005-07-11 08:51:08
我做了一个OCX,我想在OCX界面的Static上画一个ICON,于是我加入了固有的图片属性页 PROPPAGEID( CLSID_CPicturePropPage ),得到一个 LPPICTUREDISP 后,我如何能将它转化为 HICON 或 HBITMAP 呢?我不想用 CPictureHolder 对象的 Render 方法,只想用 SetIcon 或 SetBitmap ,望高人指教。
...全文
116 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
中级伴读 2005-07-14
  • 打赏
  • 举报
回复
随便一个人进来了
楼主不错,自己解决,写出解决办法,还找人给分
多谢了阿
XunBaian 2005-07-14
  • 打赏
  • 举报
回复
能不能随便进来一个人?要不我结不了贴了。
XunBaian 2005-07-14
  • 打赏
  • 举报
回复
感谢三位捧场。
FatSpiders 2005-07-14
  • 打赏
  • 举报
回复
不错。
很值得我们支持。
虽然来晚了,不过还是项一下。
qrlvls 2005-07-14
  • 打赏
  • 举报
回复
呵呵,jf
小妹的分更要接住
XunBaian 2005-07-11
  • 打赏
  • 举报
回复
没人帮帮小妹吗?
XunBaian 2005-07-11
  • 打赏
  • 举报
回复
这么久都没人帮忙,还是MSDN可靠,问题已查MSDN得到解决,请问版主,本贴如何才能结得?解决方法如下:

DRAWPIC: Extracting a Bitmap or Icon from an LPPICTUREDISP
All Visual Studio 6.0 samples are contained in a single executable, which is available for download.

At times it may be necessary in an ActiveX Control to obtain the handle to an icon or bitmap contained in a LPPICTUREDISP structure. The DRAWPIC sample demonstrates how to get a handle to a bitmap or icon from a LPPICTUREDISP.

The important lines of code in this sample are:

// get handle of the bitmap
NewPicture.m_pPict->get_Handle((OLE_HANDLE FAR *) &hBitmap);
// create a temporary bitmap
CBitmap * TempBmp = CBitmap::FromHandle(hBitmap);
// get handle of the icon
NewPicture.m_pPict->get_Handle((OLE_HANDLE FAR *) &hIcon);

Running the Sample

To run this sample, first compile, link, and register the control. Next, create an .exe test application using the Visual Basic project that ships with the sample. You can then step through the ActiveX Control code by setting the Visual Basic executable as the executable for the debug session.

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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