// UnderGroundView.cpp : 实现文件 // #include "stdafx.h" #include "resource.h" #include "UnderGroundView.h" // CUnderGroundView IMPLEMENT_DYNCREATE(CUnderGroundView, CModelessDialog) CUnderGroundView::CUnderGroundView() : CModelessDialog(CUnderGroundView::IDD) { } CUnderGroundView::~CUnderGroundView() { } void CUnderGroundView::DoDataExchange(CDataExchange* pDX) { CModelessDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CUnderGroundView, CModelessDialog) ON_STN_CLICKED(IDC_PIC_UNGR_VIEW1, OnStnClickedPicUngrView1) ON_STN_CLICKED(IDC_PIC_UNGRVIEW2, OnStnClickedPicUngrview2) ON_STN_CLICKED(IDC_PIC_UNGRVIEW3, OnStnClickedPicUngrview3) ON_STN_CLICKED(IDC_PIC_UNGRVIEW4, OnStnClickedPicUngrview4) ON_STN_CLICKED(IDC_PIC_UNGRVIEW5, OnStnClickedPicUngrview5) ON_STN_CLICKED(IDC_PIC_UNGEVIEW6, OnStnClickedPicUngeview6) ON_STN_CLICKED(IDC_PIC_UNGRVIEW7, OnStnClickedPicUngrview7) ON_STN_CLICKED(IDC_PIC_UNGRVIEW8, OnStnClickedPicUngrview8) ON_STN_CLICKED(IDC_PIC_UNGRVIEW9, OnStnClickedPicUngrview9) END_MESSAGE_MAP() // CUnderGroundView 诊断 // CUnderGroundView 消息处理程序 BOOL CUnderGroundView::OnInitDialog() { CModelessDialog::OnInitDialog(); CRect rectCur, rectParent; GetWindowRect(rectCur); GetParent()->GetWindowRect(rectParent); MoveWindow(rectParent.left+24,rectParent.top+127, rectCur.Width(), rectCur.Height()); return TRUE; } int CUnderGroundView::GetViewStyle() { return m_iStyle; } void CUnderGroundView::OnStnClickedPicUngrView1() { m_iStyle = VIEW1; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview2() { m_iStyle = VIEW2; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview3() { m_iStyle = VIEW3; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview4() { m_iStyle = VIEW4; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview5() { m_iStyle = VIEW5; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngeview6() { m_iStyle = VIEW6; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview7() { m_iStyle = VIEW7; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview8() { m_iStyle = VIEW8; CModelessDialog::OnOK(); } void CUnderGroundView::OnStnClickedPicUngrview9() { m_iStyle = VIEW9; CModelessDialog::OnOK(); } BOOL CUnderGroundView::PreTranslateMessage(MSG* pMsg) { if(pMsg->message==WM_KEYDOWN && ( pMsg->wParam==VK_SPACE || pMsg->wParam==VK_ESCAPE || pMsg->wParam == VK_RETURN)) { CModelessDialog::OnCancel(); return TRUE; } else if (pMsg->message == WM_RBUTTONDOWN) { CModelessDialog::OnCancel(); return TRUE; } //add tyj 20161012:点击对话框外,自动隐藏预览图片 if(pMsg->message == 280) CModelessDialog::OnCancel(); return CModelessDialog::PreTranslateMessage(pMsg); }