Mackz(在相互) 能留下qq吗?
解决方案 »
- CTreeListView的问题
- 哪位大虾能告诉小弟一下千千静听窗口吸引的编程原理
- 惊现猥琐帝
- Undocumented NT还是Undocumented 2000
- 在VC控制台应用程序中不能使用wininet函数嘛?
- 怎么给raio发消息,让它选中!在线等,答对马上给分!
- 高分求教!一个关于CSortListCtrl控件的问题。
- 如何判断我的文件被自己和别人一共打开/读写了多少次?请高手/专家指教。
- 寻找一个类?
- 请问如何在windows下获得CPU占用率和当前进程数?
- 大侠们有没有RealPlay控件的相关资料呀?接口文档什么的,本人的个人播放器,就缺它了!
- 请问怎么在对话框中创建工具栏?
或者加我qq 23145250
我是个菜鸟
但不知此控件的事件怎么接受,我贴一部分代码谁帮我看看
IMPLEMENT_DYNCREATE(MyTree, CFormView)MyTree::MyTree()
: CFormView(MyTree::IDD)
{
//{{AFX_DATA_INIT(MyTree)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}MyTree::~MyTree()
{
}void MyTree::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyTree)
DDX_Control(pDX, IDC_MY_TREE, m_tree);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MyTree, CFormView)
//{{AFX_MSG_MAP(MyTree)
ON_WM_LBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// MyTree diagnostics#ifdef _DEBUG
void MyTree::AssertValid() const
{
CFormView::AssertValid();
}void MyTree::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////void MyTree::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); HTREEITEM hItem1A=m_tree.InsertItem(_T("前处理"),0,1);
m_tree.InsertItem(_T("模型"),0,1,hItem1A,TVI_LAST);
HTREEITEM hItem2_1B=m_tree.InsertItem(_T("LAYER2_1B"),0,1,hItem1A,TVI_LAST);
m_tree.InsertItem(_T("LAYER3_1A"),0,1,hItem2_1B);
m_tree.InsertItem(_T("LAYER3_1B"),0,1,hItem2_1B);
m_tree.InsertItem(_T("LAYER3_1C"),0,1,hItem2_1B);
m_tree.InsertItem(_T("LAYER2_1C"),0,1,hItem1A,TVI_LAST); HTREEITEM hItem1B=m_tree.InsertItem(_T("计算"),0,1);
m_tree.InsertItem(_T("LAYER2_2A"),0,1,hItem1B,TVI_LAST);
m_tree.InsertItem(_T("LAYER2_2B"),0,1,hItem1B,TVI_LAST);
m_tree.InsertItem(_T("LAYER2_2C"),0,1,hItem1B,TVI_LAST);
}void MyTree::OnLButtonDblClk(UINT nFlags, CPoint point)
{
m_hTreeItem = m_tree.GetSelectedItem();
CString S1 = m_tree.GetItemText(m_hTreeItem);
AfxMessageBox("You have selected "+S1);
}
头文件中:
class MyTree : public CFormView
{
protected:
MyTree(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(MyTree)// Form Data
public:
//{{AFX_DATA(MyTree)
enum { IDD = IDD_MY_TREE };
CTreeCtrl m_tree;
//}}AFX_DATA// Attributes
public:
HTREEITEM m_hTreeItem;
HICON m_hIcon;
// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(MyTree)
public:
virtual void OnInitialUpdate();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
virtual ~MyTree();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif // Generated message map functions
//{{AFX_MSG(MyTree)
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};或者加我qq 23145250
不应接受MyTree::OnLButtonDblClk
而因该是MyTree::OnDblclkMyTree消息还是谢谢各位了