新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     >>计算机科学论坛<<     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论高级C/C++编程、代码重构(Refactoring)、极限编程(XP)、泛型编程等话题
    [返回] 计算机科学论坛计算机技术与应用『 C/C++编程思想 』 → CMFCButton::SetImage 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 4208 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: CMFCButton::SetImage 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     葛靖青001 美女呀,离线,快来找我吧!水瓶座1984-2-14
      
      
      等级:大三(研究MFC有点眉目了!)
      文章:168
      积分:595
      门派:XML.ORG.CN
      注册:2010/11/2

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给葛靖青001发送一个短消息 把葛靖青001加入好友 查看葛靖青001的个人资料 搜索葛靖青001在『 C/C++编程思想 』的所有贴子 点击这里发送电邮给葛靖青001 引用回复这个贴子 回复这个贴子 查看葛靖青001的博客楼主
    发贴心情 CMFCButton::SetImage

    【转自互联网】

    //Windows logo 图标 放到按钮上

      HICON hIconWinlogo= ::LoadIcon(AfxGetApp()->m_hInstance,(LPCTSTR)IDI_ICON1);

      //Home图标

      // HICON hIconHome= ::LoadIcon(AfxGetApp()->m_hInstance,(LPCTSTR)IDI_HOME);

      //关闭图标

      HICON hIconClose = ::LoadIcon(AfxGetApp()->m_hInstance,(LPCTSTR)IDI_RED_CLOSE_BOX);

      ((CMFCButton *)GetDlgItem(IDC_BTN_CALC1) )->SetImage ( hIconWinlogo ); //"计算"按钮

      ( (CMFCButton *)GetDlgItem(IDC_BTN_CALC2) )->SetImage ( hIconWinlogo ); //"计算"按钮

      ( (CMFCButton *)GetDlgItem(IDC_BTN_CALC3) )->SetImage ( hIconWinlogo ); //"计算"按钮

      ( (CMFCButton *)GetDlgItem(IDC_BTN_CALC4) )->SetImage ( hIconWinlogo ); //"计算"按钮

      ( (CMFCButton *)GetDlgItem(IDCANCEL)     )->SetImage ( hIconClose );   //退出

      CMFCButton::SetImage

      Sets the image for a button.

      Copyvoid SetImage(

      HICON hIcon,

      BOOL bAutoDestroy=TRUE,

      HICON hIconHot=NULL,

      HICON hIconDisabled=NULL,

      BOOL bAlphaBlend=FALSE

      );

      void SetImage(

      HBITMAP hBitmap,

      BOOL bAutoDestroy=TRUE,

      HBITMAP hBitmapHot=NULL,

      BOOL bMap3dColors=TRUE,

      HBITMAP hBitmapDisabled=NULL

      );

      void SetImage(

      UINT uiBmpResId,

      UINT uiBmpHotResId=0,

      UINT uiBmpDsblResID=0

      );

      Parameters

      --------------------------------------------------------------------------------

      [in] hIcon

      Handle to the icon that contains the bitmap and mask for the new image.

      [in] bAutoDestroy

      TRUE to specify that bitmap resources be destroyed automatically; otherwise, FALSE. The default is TRUE.

      [in] hIconHot

      Handle to the icon that contains the image for the selected state.

      [in] hBitmap

      Handle to the bitmap that contains the image for the non-selected state.

      [in] hBitmapHot

      Handle to the bitmap that contains the image for the selected state.

      [in] uiBmpResId

      Resource ID for the non-selected image.

      [in] uiBmpHotResId

      Resource ID for the selected image.

      [in] bMap3dColors

      Specifies a transparent color for the button background; that is, the face of the button. TRUE to use the color value RGB(192, 192, 192); FALSE to use the color value defined by AFX_GLOBAL_DATA::clrBtnFace.

      [in] hIconDisabled

      Handle to the icon for the disabled image.

      [in] hBitmapDisabled

      Handle to the bitmap that contains the disabled image.

      [in] uiBmpDsblResID

      Resource ID of the disabled bitmap.

      [in] bAlphaBlend

      TRUE to use only 32-bit images that use the alpha channel; FALSE, to not use only alpha channel images. The default is FALSE.

      Example

      --------------------------------------------------------------------------------

      The following example demonstrates how to use various versions of the SetImage method in the CMFCButton class. The example is part of the NewControls Sample: MFC Controls Demonstration Application.

      VBC#C++F#JScriptCopyCMFCButton m_Button;

      ...

      // int m_iImage

      // IDB_BTN1_32, IDB_BTN1_HOT_32, IDB_BTN1, IDB_BTN1_HOT are int macros that are #define.

      if (m_iImage == 1)

      {

      m_Button.SetImage((HBITMAP) NULL);

      }

      else

      {

      m_Button.SetImage(IDB_BTN1_32, IDB_BTN1_HOT_32);

      }


       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    ---人之所以能,是相信能!!

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2010/11/24 15:19:00
     
     GoogleAdSense水瓶座1984-2-14
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 C/C++编程思想 』的所有贴子 点击这里发送电邮给Google AdSense 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/6 13:14:03

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    62.500ms