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

📄 baddlg.cpp

📁 讲mfc的书
💻 CPP
字号:
// BadDlg.cpp : implementation file
//

#include "stdafx.h"
#include "treebug.h"
#include "BadDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CBadDlg dialog


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


void CBadDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBadDlg)
	DDX_Control(pDX, IDC_TREE1, m_tree);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBadDlg, CDialog)
	//{{AFX_MSG_MAP(CBadDlg)
	ON_NOTIFY(TVN_ENDLABELEDIT, IDC_TREE1, OnEndlabeleditTree1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBadDlg message handlers

BOOL CBadDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	HTREEITEM item;
	item=m_tree.InsertItem("Home Number");
	m_tree.InsertItem("555-1252",item);
	item=m_tree.InsertItem("Work Number");
	m_tree.InsertItem("555-1253",item);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CBadDlg::OnOK() 
{
	if (Fix) 
		{
		if (CWnd::GetFocus()->GetParent()==&m_tree) // bogus OK from edit control
			{
			CWnd *ectl=CWnd::GetFocus();
			ectl->SendMessage(WM_KEYDOWN,VK_RETURN);
			// as odd as it seems, don't send a KEYUP
			// because by the time it gets there, the edit control
			// will be gone!
			// ectl->SendMessage(WM_KEYUP,VK_RETURN);
			return; 
			}
		}
	CDialog::OnOK();

}

void CBadDlg::OnEndlabeleditTree1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	TV_DISPINFO* info = (TV_DISPINFO*)pNMHDR;
    if (info->item.pszText)
		{
		info->item.mask=TVIF_TEXT;
		m_tree.SetItem(&info->item);
		}
	*pResult = 0;
}

⌨️ 快捷键说明

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