⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlglayers.cpp

📁 MapX的基本应用
💻 CPP
字号:
// DlgLayers.cpp : implementation file
//

#include "stdafx.h"
#include "MapXSingle.h"
#include "DlgLayers.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgLayers dialog


CDlgLayers::CDlgLayers(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgLayers::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgLayers)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgLayers::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgLayers)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgLayers, CDialog)
	//{{AFX_MSG_MAP(CDlgLayers)
	ON_NOTIFY(NM_DBLCLK, IDC_LIS_Layers, OnDblclkLISLayers)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgLayers message handlers

BOOL CDlgLayers::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CListCtrl* p_clCtrl;
	p_clCtrl=(CListCtrl*)GetDlgItem(IDC_LIS_Layers);
	p_clCtrl->InsertColumn(0,"地图图层",LVCFMT_LEFT,200);
	p_clCtrl->InsertColumn(1,"是否可见",LVCFMT_LEFT,200);
	
	CMapXLayers m_mxLayers;
	m_mxLayers=p_mx->GetLayers();
	int i;
	for (i=0;i<m_mxLayers.GetCount();i++)
	{
		p_clCtrl->InsertItem(i,m_mxLayers.Item(i+1).GetName());
		p_clCtrl->SetItemText(i,1,m_mxLayers.Item(i+1).GetVisible() ? "是" : "否");
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

//列表控件的左键双击
void CDlgLayers::OnDblclkLISLayers(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	CString str;
	NM_LISTVIEW* pNMListView=(NM_LISTVIEW*)pNMHDR;
	if (pNMListView->iItem!=-1)
	{
		int i=MessageBox("确实要修改该图层的显示状况吗?","提醒",MB_YESNO|MB_ICONQUESTION);
		if (i==6)
		{
			CListCtrl* p_clCtrl;
			p_clCtrl=(CListCtrl*)GetDlgItem(IDC_LIS_Layers);
			str=p_clCtrl->GetItemText(pNMListView->iItem,1);
			if(str=="是")
				str="否";
			else
				str="是";
			p_clCtrl->SetItemText(pNMListView->iItem,1,str);
			CMapXLayers m_mxLayers;
			m_mxLayers=p_mx->GetLayers();
			m_mxLayers.Item(pNMListView->iItem+1).SetVisible((str=="是") ? true : false);
		}
	}
	*pResult = 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -