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

📄 ds_btreedlg.h

📁 数据结构中B-树经典算法的可视化执行程序
💻 H
字号:
// DS_BTreeDlg.h : header file
//

#if !defined(AFX_DS_BTREEDLG_H__6EB02AC5_2114_46BF_9584_8285BCA17FB1__INCLUDED_)
#define AFX_DS_BTREEDLG_H__6EB02AC5_2114_46BF_9584_8285BCA17FB1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "BTree.h" 
#include <time.h>
#include <stdlib.h>

/////////////////////////////////////////////////////////////////////////////
// CDS_BTreeDlg dialog

class CDS_BTreeDlg : public CDialog
{
// Construction
public:
	CDS_BTreeDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CDS_BTreeDlg)
	enum { IDD = IDD_DS_BTREE_DIALOG };
	CButton	m_CreateRandNode;
	CSpinButtonCtrl	m_RandSpin;
	int		m_DeleteData;
	int		m_InsertData;
	int		m_RandCount;
	int		m_NodeCount;
	int		m_TreeKey;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDS_BTreeDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CDS_BTreeDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnSetTreeKey();
	afx_msg void OnInsertNode();
	afx_msg void OnDeleteNode();
	afx_msg void OnCreateRandNode();
	afx_msg void OnEraseall();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnAbout();
	afx_msg void Onhelp();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()


private:
	BTree *m_BTree;
	CClientDC  *DrawDC;
	CScrollBar *hScroll;
	CStatic *Board;
	int pos_x;
	CRect m_VisRect;
	CPen m_Pen;
	int NodeWidth;  //结点的宽
	int NodeHeight; //结点的高
	int DeepHeight; //树各层之间的距离
	int MaxWidth;   //画所有节点最大的宽度

	void CreateBTree(int key);  //创建B-树
	void DrawNode(BTreeNode *node);  //以方框的形式画出结点并显示结点的内容
	void DrawLine(BTreeNode *node);	 //画连接结点及其子结点的线条
	void SetLeafNodeQue(queue<BTreeNode*> & que);    //设置叶结点的队列
	void SetParentNodePos(queue<BTreeNode*> & que);  //设置父结点的队列
	void SetNodePos();  //设置B-树中各结点的位置
public:
	void DrawDetail();  //画出各结点
	void SetDC();  //设置画图的DC
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DS_BTREEDLG_H__6EB02AC5_2114_46BF_9584_8285BCA17FB1__INCLUDED_)

⌨️ 快捷键说明

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