Пример #1
0
int CDocViewCoreCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (!m_bUIActive)
		OnActivateInPlace (TRUE, NULL); // == UI-Activate the control
	return COleControl::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
int CThingTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	BOOL bCreate = FALSE;
	RECT rect;
	DWORD dwStyle = 0;
	CString strName;

	
	if (CVWUIView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	OnActivateInPlace(TRUE, NULL);
	
	// create any image list necessary here
	if (!m_pImageList)
	{
		m_pImageList = new CImageList;
		m_pImageList->Create(IDB_TREEICON, 16, 0, 0x00FFFFFF);
	}

	GetClientRect( &rect );
	dwStyle =  TVS_HASLINES | TVS_HASBUTTONS | WS_VISIBLE | WS_CHILD | TVS_SHOWSELALWAYS;

	bCreate = m_treeCtrl.Create( dwStyle, rect, this, 255);

	m_treeCtrl.SetImageList(m_pImageList,TVSIL_NORMAL);

	// add the world item
	strName.LoadString(IDS_WORLD);
	m_hWorld = m_treeCtrl.InsertItem(LPCTSTR(strName), IT_WORLD, IT_WORLD, TVI_ROOT, TVI_LAST);
	m_treeCtrl.SetItemData(m_hWorld, (DWORD) -1);
	
	// add the modules item
	strName.LoadString(IDS_MODULES);
	m_hModules = m_treeCtrl.InsertItem(LPCTSTR(strName), IT_EXEMPLAR, IT_EXEMPLAR, TVI_ROOT, TVI_LAST);
	m_treeCtrl.SetItemData(m_hModules, (DWORD) -1);

	if (m_pWorld)
	{
		FillWorldNode();
		FillRoomNode();
		m_treeCtrl.EnsureVisible(m_hWorld);
	}

	return bCreate;
}
Пример #3
0
int CDocViewCoreCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (COleControl::OnCreate(lpCreateStruct) == -1)
		return -1;

	OnActivateInPlace (TRUE, NULL); // == UI-Activate the control
	// TODO:  在此添加您专用的创建代码
	if (m_ViewDlg.m_hWnd == NULL)
	{
		m_ViewDlg.Create(m_ViewDlg.IDD,this);
		m_ViewDlg.ShowWindow(SW_SHOW);
	}
	if (m_PreviewDlg.m_hWnd == NULL)
	{
		m_PreviewDlg.Create(m_PreviewDlg.IDD,this);
		m_PreviewDlg.ShowWindow(SW_SHOW);
	}
	return 0;
}