BmpButton.cpp
上传用户:hahaxixi
上传日期:2022-04-15
资源大小:1939k
文件大小:1k
源码类别:

手机短信编程

开发平台:

Visual C++

  1. // BmpButton.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "NoteManage.h"
  5. #include "BmpButton.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CBmpButton
  13. CBmpButton::CBmpButton()
  14. {
  15. }
  16. CBmpButton::~CBmpButton()
  17. {
  18. }
  19. BEGIN_MESSAGE_MAP(CBmpButton, CButton)
  20. //{{AFX_MSG_MAP(CBmpButton)
  21. ON_WM_MOUSEMOVE()
  22. //}}AFX_MSG_MAP
  23. END_MESSAGE_MAP()
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CBmpButton message handlers
  26. void CBmpButton::SetHBitmap(HBITMAP m_hbmp1, HBITMAP m_hbmp2)
  27. {
  28. m_Hbitmap1 = m_hbmp1;
  29. m_Hbitmap2 = m_hbmp2;
  30. }
  31. void CBmpButton::OnMouseMove(UINT nFlags, CPoint point) 
  32. {
  33. // TODO: Add your message handler code here and/or call default
  34. CButton::OnMouseMove(nFlags, point);
  35. CRect rect;
  36. GetClientRect(&rect);
  37. if(rect.PtInRect(point))
  38. {
  39. SetCapture();
  40. SetBitmap(m_Hbitmap1);
  41. }
  42. else
  43. {
  44. ReleaseCapture();
  45. SetBitmap(m_Hbitmap2);
  46. }
  47. }