位图按钮

本文介绍如何使用BM_SETIMAGE消息为按钮设置图标或位图。通过指定不同参数,可以实现按钮图像的灵活更改,适用于多种风格的按钮设计。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果需要在按钮中显示图标或位图,您可以用BS_ICON或BS_BITMAP风格,并用BM_SETIMAGE消息设置位图,对于BS_OWNERDRAW风格的按钮,它允许完全自由地绘制按钮。

BM_SETIMAGE  
  An   application   sends   a   BM_SETIMAGE   message   to   associate   a   new   image   (icon   or   bitmap)   with   the   button.  
   
  To   send   this   message,   call   the   SendMessage   function   with   the   following   parameters.    
   
  SendMessage(    
      (HWND)   hWnd,                             //   handle   to   destination   window    
      BM_SETIMAGE,                             //   message   to   send  
      (WPARAM)   wParam,                     //   image   type  
      (LPARAM)   lParam                     //   handle   to   the   image   (HANDLE)  
  );  
  Parameters  
  wParam    
  Specifies   the   type   of   image   to   associate   with   the   button.   This   parameter   can   be   one   of   the   following   values:    
  IMAGE_BITMAP  
  IMAGE_ICON    
   
  lParam    
  Handle   to   the   image   to   associate   with   the   button.    
  Return   Values  
  The   return   value   is   a   handle   to   the   image   previously   associated   with   the   button,   if   any;   otherwise,   it   is   NULL.  
   
  Remarks  
  Requirements    
      Windows   NT/2000:   Requires   Windows   NT   4.0   or   later.  
      Windows   95/98:   Requires   Windows   95   or   later.  
      Header:   Declared   in   Winuser.h;   include   Windows.h.  
   
  See   Also  
  Buttons   Overview,   Button   Messages,   BM_GETIMAGE      

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值