?? 二叉樹的顯示輸出view.h
字號:
// 二叉樹的顯示輸出View.h : interface of the CMyView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_VIEW_H__FA456E53_F5CE_4D79_97E4_4F800FFF31BA__INCLUDED_)
#define AFX_VIEW_H__FA456E53_F5CE_4D79_97E4_4F800FFF31BA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BinTree3P.h"
class CMyView : public CView
{
protected: // create from serialization only
CMyView();
DECLARE_DYNCREATE(CMyView)
// Attributes
public:
CMyDoc* GetDocument();
public:
int m_nTreeLever; //儲存樹的層數(shù)
int m_nLeverDista; //儲存不同層中間的垂直間隔
int m_nHorizoDista; //儲存屏幕寬度的一般 即根節(jié)點的橫坐標
// Operations
public:
void DrawTree(CBinTree3P<char> & pTree,CDC* pDC); //用于畫出整個樹
void DrawTreNode(CBinTreNode<char> *pNode,int x,int y,int nLeverNow,int nHoriDisNow, CDC * pDC);
//畫出一個節(jié)點,并遞歸調(diào)用自己從而畫出整個樹。
void AnalyzeTree();
//調(diào)用analyzeNode函數(shù)分析樹的層數(shù),并儲存在treeLever中,同時計算并儲存m_nLeverDista。
void AnalyzeNode(CBinTreNode<char> *pNode,int nLeverNow);
//遞歸調(diào)用自己,遍歷整個樹,如果nLeverNow> m_nTreeLever
//則m_nTreeLever = nLeverNow;且每次遞歸調(diào)用自己時層數(shù)加1;
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CMyView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in 二叉樹的顯示輸出View.cpp
inline CMyDoc* CMyView::GetDocument()
{ return (CMyDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEW_H__FA456E53_F5CE_4D79_97E4_4F800FFF31BA__INCLUDED_)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -