// 线性单链表Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "线性单链表.h"
#include "线性单链表Dlg.h"
#include<math.h> // 数学公式
#include "Insert.h" // 人工加此句
#include "Locate.h" // 人工加此句
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
POINT Dialog,Graph,Screen; // 对话框尺寸,绘图区尺寸,屏幕尺寸
LinkList LL; // 单链表的头指针
LinkListDlg* m_pOwner; // 指向对话框的指针
int DialogFlag; // 对话框标志
bool LL_1th = false ;//插入的是第一个结点 true为插入的是第一个结点
static bool ll_flag = false;//指示链表是否已经初始化,false为未初始化
bool Button3Up=true; // “下一步”按钮的状态。false:按下;true:抬起
static HWND hWnd; // 多线程用到
const int SliderHeight=40; // 滑块控件的高度
const int SliderMax=5000; // 滑块最大值
const int SliderMin=0; // 滑块最小值
const int LabelHeight=20; // 标签高度
const double ar=10; // 箭头长度
const double as=20; // 箭头夹角角度的一半
CString s; // 字符串变量
ElemType e1;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LinkListDlg dialog
LinkListDlg::LinkListDlg(CWnd* pParent /*=NULL*/)
: CDialog(LinkListDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(LinkListDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
// draw(50,140,100,40);
}
void LinkListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LinkListDlg)
DDX_Control(pDX, IDC_LISTTRAVERSE_BUTTON, m_Traverse);
DDX_Control(pDX, IDC_NEXTELEM_BUTTON, m_Next);
DDX_Control(pDX, IDC_PRIORELEM_BUTTON, m_Prior);
DDX_Control(pDX, IDC_LOCATEELEM_BUTTON, m_Locate);
DDX_Control(pDX, IDC_GETELEM_BUTTON, m_Get);
DDX_Control(pDX, IDC_LISTLENGTH_BUTTON, m_Length);
DDX_Control(pDX, IDC_LISTEMPTY_BUTTON, m_Empty);
DDX_Control(pDX, IDC_DESTROYLIST_BUTTON, m_Destroy);
DDX_Control(pDX, IDC_CLEARLIST_BUTTON, m_Clear);
DDX_Control(pDX, IDC_LISTDELETE_BUTTON, m_Delete);
DDX_Control(pDX, IDC_LISTINSERT_BUTTON, m_Insert);
DDX_Control(pDX, IDC_INITLIST_BUTTON, m_Init);
DDX_Control(pDX, IDC_STATIC2, m_Struct);
DDX_Control(pDX, IDC_STATIC1, m_Info);
DDX_Control(pDX, IDC_NEXT_BUTTON, m_next);
DDX_Control(pDX, IDC_CONTROL_BUTTON, m_change);
DDX_Control(pDX, IDC_CODE_LIST, m_algo);
DDX_Control(pDX, IDC_SLIDER1, m_Slider);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(LinkListDlg, CDialog)
//{{AFX_MSG_MAP(LinkListDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_INITLIST_BUTTON, OnInitListButton)
ON_BN_CLICKED(IDC_CONTROL_BUTTON, OnType)
ON_BN_CLICKED(IDC_NEXT_BUTTON, OnNextButton)
ON_BN_CLICKED(IDC_EXIT_BUTTON, OnExitButton)
ON_BN_CLICKED(IDC_LISTINSERT_BUTTON, OnListInsertButton)
ON_BN_CLICKED(IDC_DESTROYLIST_BUTTON, OnDestroyListButton)
ON_BN_CLICKED(IDC_CLEARLIST_BUTTON, OnClearListButton)
ON_BN_CLICKED(IDC_LISTEMPTY_BUTTON, OnListEmptyButton)
ON_BN_CLICKED(IDC_LISTLENGTH_BUTTON, OnListLengthButton)
ON_BN_CLICKED(IDC_GETELEM_BUTTON, OnGetElemButton)
ON_BN_CLICKED(IDC_LOCATEELEM_BUTTON, OnLocateElemButton)
ON_BN_CLICKED(IDC_PRIORELEM_BUTTON, OnPriorElemButton)
ON_BN_CLICKED(IDC_NEXTELEM_BUTTON, OnNextElemButton)
ON_BN_CLICKED(IDC_LISTTRAVERSE_BUTTON, OnListTraverseButton)
ON_BN_CLICKED(IDC_LISTDELETE_BUTTON, OnListDeleteButton)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LinkListDlg message handlers
BOOL LinkListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CRect rect;
int x,y;
_fullpath(full,part, _MAX_PATH); // 求得算法的路径存于full中
ShowWindow(SW_SHOWMAXIMIZED); // 最大化对话框窗口
GetClientRect(rect); // 得到对话框的窗口尺寸并赋给rect(左上角为0,0)
Dialog.x=rect.right; // 将对话框的窗口尺寸赋给全局坐标变量Dialog
Dialog.y=rect.bottom;
Graph.x=long(Dialog.x*ViewX); // 得到对话框窗口中绘图区(视口)尺寸
Graph.y=long(Dialog.y*ViewY);
GetScreenSize(); // 求得屏幕尺寸赋给全局变量Screen
m_Slider.SetWindowPos(NULL,Graph.x,0,Dialog.x-Graph.x,SliderHeight,SWP_SHOWWINDOW); // 设置滑块控件在右上角
m_Slider.SetRange(SliderMin,SliderMax); // 设置滑块的范围
m_Slider.SetTicFreq((SliderMax-SliderMin)/10); // 设置滑块的标记出现的频率
m_Slider.SetPos((SliderMax+SliderMin)/5); // 设置滑块位置
m_Info.SetWindowPos(NULL,Graph.x,SliderHeight,Dialog.x-Graph.x,LabelHeight,SWP_SHOWWINDOW); // 设置滑块标签控件在滑块控件的下面
m_Struct.SetWindowPos(NULL,Graph.x,SliderHeight+LabelHeight*2,Dialog.x-Graph.x,LabelHeight,SWP_SHOWWINDOW); // 设置算法标签控件在滑块标签控件的下面
m_algo.SetWindowPos(NULL,Graph.x,SliderHeight+LabelHeight*3,Dialog.x-Graph.x,Graph.y-(SliderHeight+LabelHeight*3),SWP_SHOWWINDOW); // 设置List Box在算法标签控件的下面
m_algo.SetHorizontalExtent(800); // 设置水平宽度
m_Init.GetClientRect(rect); // 得到“Init”按钮的尺寸并赋给rect(左上角为0,0),所有按钮尺寸相同
x=Dialog.x/2/12; // 第一个按钮中心的水平坐标(12个按钮)
y=(Dialog.y+2*Graph.y)/3-rect.bottom/2; // 按钮的垂直坐标
m_Init.SetWindowPos(NULL,x-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Init”按钮在左下角
m_Insert.SetWindowPos(NULL,x*3-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Insert”按钮在“Init”按钮的右边
m_Delete.SetWindowPos(NULL,x*5-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Delete”按钮在“Insert”按钮的右边
m_Clear.SetWindowPos(NULL,x*7-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Clear”按钮在“Delete”按钮的右边
m_Destroy.SetWindowPos(NULL,x*9-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Destroy”按钮在“Clear”按钮的右边
m_Empty.SetWindowPos(NULL,x*11-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Empty”按钮在“Destroy”按钮的右边
m_Length.SetWindowPos(NULL,x*13-rect.right/2,y,0,0,SWP_NOSIZE);//设置“Length”按钮在“Empty”按钮的右边
m_Get.SetWindowPos(NULL,x*15-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Get”按钮在“Length”按钮的右边
m_Locate.SetWindowPos(NULL,x*17-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Locate”按钮在“Get”按钮的右边
m_Prior.SetWindowPos(NULL,x*19-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Prior”按钮在“Locate”按钮的右边
m_Next.SetWindowPos(NULL,x*21-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“Next”按钮在“Prior”按钮的右边
m_Traverse.SetWindowPos(NULL,x*23-rect.right/2,y,0,0,SWP_NOSIZE); // 设置“T
数据结构单链表vc++演示
5星 · 超过95%的资源 需积分: 10 22 浏览量
2009-05-08
19:54:53
上传
评论
收藏 3.54MB RAR 举报
xuexujie
- 粉丝: 0
- 资源: 1
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈