📄 dfsbar.cpp
字号:
// DFSBar.cpp : implementation file
//
#include "stdafx.h"
#include "GraphSearch.h"
#include "DFSBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDFSBar
CDFSBar::CDFSBar()
{
}
CDFSBar::~CDFSBar()
{
}
BEGIN_MESSAGE_MAP(CDFSBar, CDialogBar)
//{{AFX_MSG_MAP(CDFSBar)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDFSBar message handlers
int CDFSBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//创建
m_staticTitle.Create("深度优先搜索", WS_VISIBLE | WS_TABSTOP | WS_CHILD | SS_SUNKEN
| SS_CENTER, CRect(10,10,100,100),
this, IDC_STATIC_TITLE);
//创建输入起点,终点的编辑框
m_staticStart.Create("搜索起始点:", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_STATIC_START);
m_staticEnd.Create("搜索目标点:", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_STATIC_END);
m_editStart.Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER | ES_NUMBER, CRect(10,10,100,100),
this, IDC_EDIT_START);
m_editEnd.Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER | ES_NUMBER, CRect(10,10,100,100),
this, IDC_EDIT_END);
//创建各种按钮
m_buttonStart.Create("开始搜索", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_BUTTON_DFS);
m_buttonShowGraph.Create("显示/不显示原始图", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_BUTTON_SHOW_GRAPH);
m_buttonShowTree.Create("显示/不显示搜索范围", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_BUTTON_SHOW_TREE);
m_buttonShowSequence.Create("显示/不显示搜索顺序", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_BUTTON_SHOW_SEQUENCE);
m_buttonBack.Create("退出搜索界面", WS_VISIBLE | WS_TABSTOP | WS_CHILD, CRect(10,10,100,100),
this, IDC_BUTTON_BACK);
//创建搜索结果列表
m_list.Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER |
LVS_REPORT, CRect(10, 10, 100, 100), this, IDC_BAR_LIST);
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_list.InsertColumn(0,"搜索顺序",LVCFMT_CENTER,98,0);
m_list.InsertColumn(1,"节点ID",LVCFMT_CENTER,98,1);
return 0;
}
void CDFSBar::OnSize(UINT nType, int cx, int cy)
{
CDialogBar::OnSize(nType, cx, cy);
CRect rc;
GetClientRect(&rc);
int panelX = rc.left+2;
int panelY = rc.top+14;
int panelW = rc.Width()-4;
int panelH = rc.Height()-4;
CRect rect(panelX+4, panelY, panelX+panelW, panelY+20);
m_staticTitle.MoveWindow(rect);
//////////////////////////////////////////////////////////////////////////
//
CRect rect1(panelX+4, panelY+25, panelX+panelW/2, panelY+44);
m_staticStart.MoveWindow(rect1);
CRect rect2(panelX+panelW/2, panelY+24, panelX+panelW-4, panelY+44);
m_editStart.MoveWindow(rect2);
CRect rect3(panelX+4, panelY+49, panelW/2, panelY+68);
m_staticEnd.MoveWindow(rect3);
CRect rect4(panelX+panelW/2, panelY+48, panelX+panelW-4, panelY+68);
m_editEnd.MoveWindow(rect4);
//////////////////////////////////////////////////////////////////////////
//
CRect rect5(panelX+4, panelY+72, panelX+panelW-4, panelY+94);
m_buttonStart.MoveWindow(rect5);
CRect rect6(panelX+4, panelY+96, panelX+panelW-4, panelY+118);
m_buttonShowTree.MoveWindow(rect6);
CRect rect7(panelX+4, panelY+120, panelX+panelW-4, panelY+142);
m_buttonShowGraph.MoveWindow(rect7);
CRect rect8(panelX+4, panelY+144, panelX+panelW-4, panelY+168);
m_buttonShowSequence.MoveWindow(rect8);
CRect rect9(panelX+4, panelY+170, panelX+panelW-4, panelY+192);
m_buttonBack.MoveWindow(rect9);
//////////////////////////////////////////////////////////////////////////
//重新绘制搜索结果列表
CRect rect10(panelX+4, panelY+196, panelX+panelW-4, panelY+panelH-20);
m_list.MoveWindow(rect10);
}
void CDFSBar::init(CString title)
{
m_staticTitle.SetWindowText(title);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -