PointInfo.cpp
上传用户:z_mail1980
上传日期:2007-06-01
资源大小:647k
文件大小:2k
源码类别:

SNMP编程

开发平台:

Visual C++

  1. // PointInfo.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "exam3.h"
  5. #include "PointInfo.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CPointInfo dialog
  13. CPointInfo::CPointInfo(CWnd* pParent /*=NULL*/)
  14. : CDialog(CPointInfo::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CPointInfo)
  17. m_strMouseX = _T("");
  18. m_strMouseY = _T("");
  19. //}}AFX_DATA_INIT
  20. m_pParentWnd=pParent;
  21. }
  22. void CPointInfo::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CPointInfo)
  26. DDX_Control(pDX, IDC_POINT_LIST, m_List);
  27. DDX_Text(pDX, IDC_MOUSE_X, m_strMouseX);
  28. DDX_Text(pDX, IDC_MOUSE_Y, m_strMouseY);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CPointInfo, CDialog)
  32. //{{AFX_MSG_MAP(CPointInfo)
  33. ON_BN_CLICKED(IDC_DELETE, OnDelete)
  34. ON_BN_CLICKED(IDC_CLOSE, OnClose)
  35. ON_MESSAGE(WM_ADD_POINT,OnAddPoint)
  36. ON_MESSAGE(WM_MOUSE_CHANGED,OnMouseChanged)
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CPointInfo message handlers
  41. void CPointInfo::OnDelete() 
  42. {
  43. int index=m_List.GetCurSel();
  44. if(index==LB_ERR) return;
  45. m_List.DeleteString(index);
  46. m_pParentWnd->SendMessage(WM_DELETE_POINT,0,(LPARAM)index);
  47. }
  48. void CPointInfo::OnClose() 
  49. {
  50. ShowWindow(SW_HIDE);
  51. }
  52. void CPointInfo::OnAddPoint(WPARAM wParam,LPARAM lParam)
  53. {
  54. int x=LOWORD(lParam);
  55. int y=HIWORD(lParam);
  56. CString szString;
  57. szString.Format("(%d,%d)",x,y);
  58. m_List.AddString(szString);
  59. }
  60. void CPointInfo::OnMouseChanged(WPARAM wParam,LPARAM lParam)
  61. {
  62. int x=LOWORD(lParam);
  63. int y=HIWORD(lParam);
  64. m_strMouseX.Format("x= %d",x);
  65. m_strMouseY.Format("y= %d",y);
  66. UpdateData(FALSE);
  67. }