PointInfo.cpp
上传用户:z_mail1980
上传日期:2007-06-01
资源大小:647k
文件大小:2k
- // PointInfo.cpp : implementation file
- //
- #include "stdafx.h"
- #include "exam3.h"
- #include "PointInfo.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CPointInfo dialog
- CPointInfo::CPointInfo(CWnd* pParent /*=NULL*/)
- : CDialog(CPointInfo::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CPointInfo)
- m_strMouseX = _T("");
- m_strMouseY = _T("");
- //}}AFX_DATA_INIT
- m_pParentWnd=pParent;
- }
- void CPointInfo::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPointInfo)
- DDX_Control(pDX, IDC_POINT_LIST, m_List);
- DDX_Text(pDX, IDC_MOUSE_X, m_strMouseX);
- DDX_Text(pDX, IDC_MOUSE_Y, m_strMouseY);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CPointInfo, CDialog)
- //{{AFX_MSG_MAP(CPointInfo)
- ON_BN_CLICKED(IDC_DELETE, OnDelete)
- ON_BN_CLICKED(IDC_CLOSE, OnClose)
- ON_MESSAGE(WM_ADD_POINT,OnAddPoint)
- ON_MESSAGE(WM_MOUSE_CHANGED,OnMouseChanged)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CPointInfo message handlers
- void CPointInfo::OnDelete()
- {
- int index=m_List.GetCurSel();
- if(index==LB_ERR) return;
- m_List.DeleteString(index);
- m_pParentWnd->SendMessage(WM_DELETE_POINT,0,(LPARAM)index);
- }
- void CPointInfo::OnClose()
- {
- ShowWindow(SW_HIDE);
-
- }
- void CPointInfo::OnAddPoint(WPARAM wParam,LPARAM lParam)
- {
- int x=LOWORD(lParam);
- int y=HIWORD(lParam);
- CString szString;
- szString.Format("(%d,%d)",x,y);
- m_List.AddString(szString);
- }
- void CPointInfo::OnMouseChanged(WPARAM wParam,LPARAM lParam)
- {
- int x=LOWORD(lParam);
- int y=HIWORD(lParam);
- m_strMouseX.Format("x= %d",x);
- m_strMouseY.Format("y= %d",y);
- UpdateData(FALSE);
- }