rrr.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
源码类别:

模拟服务器

开发平台:

C/C++

  1. void CBmpDlg::OnMouseMove(UINT nFlags, CPoint point)
  2. {
  3. CWnd * pWnd; 
  4. HCURSOR MyCursor; 
  5. CRgn m_regionPower; //Region of POWER Button
  6. CRgn m_regionPlay; //Region of PLAY Button
  7. //建立位图按钮的矩形区域
  8. m_regionPower.CreateEllipticRgnIndirect(CRect(27,56,72,92)); 
  9. m_regionPlay.CreateEllipticRgnIndirect(CRect(78,56,120,92));
  10. CString ShowString0 = "鼠标的光标在位图按钮上!!!";
  11. … … … …
  12. m_bPlay = FALSE;
  13. m_bPower= FALSE;
  14. if (m_regionPower.PtInRegion(point)) //鼠标落在位图按钮之上 
  15. {
  16. m_bPower = TRUE; 
  17. //将位图按钮设置成获得输入状态
  18. pWnd= GetDlgItem(IDC_BUTTON_POWER);
  19. pWnd->SetFocus(); 
  20. SetCapture();
  21. InputEdit().SetWindowText(ShowString0);
  22. InputEdit().ShowWindow(TRUE); 
  23. //将鼠标光标变成小手形状
  24. MyCursor = AfxGetApp()->LoadCursor(IDC_MYCURSOR); 
  25. ::SetCursor(MyCursor);
  26. VERIFY(m_Play.LoadBitmaps("PLAYU","PLAYD","PLAYF","PLAYX"));
  27. m_bPressedPlay = FALSE;
  28. return;
  29. }
  30. if (m_regionPlay.PtInRegion(point)) //鼠标落在位图按钮之上 
  31. if (m_bPowerOn) { //如果电源已被开启
  32. m_bPlay = TRUE; 
  33. pWnd= GetDlgItem(IDC_BUTTON_PLAY);
  34. pWnd->SetFocus(); 
  35. SetCapture();
  36. InputEdit().SetWindowText(ShowString0);
  37. InputEdit().ShowWindow(TRUE);
  38. MyCursor = AfxGetApp()->LoadCursor(IDC_MYCURSOR);
  39. ::SetCursor(MyCursor); 
  40. VERIFY(m_Power.LoadBitmaps("POWERONU","POWEROND","POWERONF"));
  41. }
  42. else { //如果电源已被关闭
  43. ReleaseCapture();
  44. InputEdit().SetWindowText(ShowString0+ShowString2);
  45. InputEdit().ShowWindow(TRUE); 
  46. VERIFY(m_Power.LoadBitmaps("POWEROFU","POWEROFD","POWEROFF"));
  47. m_bPressedPower= FALSE;
  48. return;
  49. }
  50. //鼠标落在所有的位图按钮之外 
  51. ReleaseCapture();
  52. InputEdit().SetWindowText(ShowString1);
  53. InputEdit().ShowWindow(TRUE); 
  54. pWnd= GetDlgItem(IDOK);
  55. pWnd->SetFocus(); 
  56. VERIFY(m_Play.LoadBitmaps("PLAYU","PLAYD","PLAYF","PLAYX"));
  57. if (m_bPowerOn)
  58. VERIFY(m_Power.LoadBitmaps("POWERONU","POWEROND","POWERONF"));
  59. else
  60. VERIFY(m_Power.LoadBitmaps("POWEROFU","POWEROFD","POWEROFF"));
  61. m_bPressedPlay = FALSE;
  62. m_bPressedPower= FALSE;
  63. CDialog::OnMouseMove(nFlags, point);
  64. }