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

📄 mydlgbar.cpp

📁 基于SUPERMAP、VC++的二次开发
💻 CPP
字号:
// MyDlgBar.cpp : implementation file
//

#include "stdafx.h"
#include "SuperMap Example.h"
#include "MyDlgBar.h"
#include "MainFrm.h"
#include "SuperMap.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyDlgBar dialog


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


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


BEGIN_MESSAGE_MAP(CMyDlgBar, CDialogBar)
	//{{AFX_MSG_MAP(CMyDlgBar)
	ON_WM_CREATE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_EVENTSINK_MAP(CMyDlgBar, CDialogBar)
    //{{AFX_EVENTSINK_MAP(CMyDlgBar)
	ON_EVENT(CMyDlgBar, 1, 2 /* RClick */, OnRClickSuperWks, VTS_I4 VTS_BSTR VTS_BSTR)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlgBar message handlers

int CMyDlgBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialogBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	m_SuperWksMng.Create("WksMng",WS_CHILD|WS_VISIBLE,CRect(0,0,200,442),this,1,NULL,false);
	m_SuperWksMng.SetMapTab(false);
	m_SuperWksMng.SetLayoutTab(false);
	m_SuperWksMng.SetResourceTab(false);
	return 0;

}

void CMyDlgBar::OnRClickSuperWks(long nFlag, LPCTSTR strSelected, LPCTSTR strParent) 
{
	//弹出右键菜单让用户选择
	if(nFlag!=1)
	{
		return;
	}
	if(strSelected=="")
	{
		return;
	}
	if(strParent=="")
	{
		return;
	}
	CsoDataset		objDataset;
	CsoDataSource	objDs;
	CsoDatasets		objDts;
	COleVariant		var;
	CMenu popMenu;
	CMenu *pMenu;
	POINT pt;
	CMainFrame *pFrame = (CMainFrame *)::AfxGetMainWnd();
	var=strParent;
	objDs=pFrame->m_SuperWorkspace.GetDatasources().GetItem(var);
	var=strSelected;
	objDts=objDs.GetDatasets();
	objDataset=objDts.GetItem(var);
	if(objDataset.GetType()==scdTabular )
	{
		return;
	}
	::GetCursorPos((LPPOINT)&pt);
	popMenu.LoadMenu(IDR_POPUP);		
	pMenu = popMenu.GetSubMenu (0);	
	if(objDataset.GetType()==scdLine || objDataset.GetType()==scdNetwork)
	{
		pMenu->EnableMenuItem(ID_DT_TOPO,false);
	}
	strDt=strSelected;
	strDs=strParent;
	pMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON,	pt.x, pt.y, this);
	
}

void CMyDlgBar::OnDestroy() 
{
	CDialogBar::OnDestroy();
	m_SuperWksMng.Disconnect();
}

⌨️ 快捷键说明

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