?? graph.cpp
字號:
// Graph.cpp : 實現文件
//
#include "stdafx.h"
#include "AI.h"
#include "Graph.h"
#include ".\graph.h"
// CGraph 對話框
IMPLEMENT_DYNAMIC(CGraph, CDialog)
CGraph::CGraph(CWnd* pParent /*=NULL*/)
: CDialog(CGraph::IDD, pParent)
{
}
CGraph::~CGraph()
{
}
void CGraph::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CGraph, CDialog)
ON_WM_PAINT()
END_MESSAGE_MAP()
// CGraph 消息處理程序
/*const int step = 25, len = 75;
void CGraph::paintLine(CPoint first, CPoint second, CDC * dc)
{
if(first.x == second.x){
dc->MoveTo(first.x + (len >> 1), first.y + len);
dc->LineTo(second.x + (len >> 1), second.y);
}else if(first.x < second.x){
dc->MoveTo(first.x + len, first.y + (len >> 1) );
dc->LineTo(second.x, second.y + (len >> 1) );
}else{
dc->MoveTo(first.x, first.y + (len >> 1) );
dc->LineTo(second.x + len, second.y + (len >> 1) );
}
}
void CGraph::ShowNode(int status, CPoint point, CDC *dc)
{
const static int ten[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000};
CPoint save = point;
for(int i = 0; i <= 3; ++i, point.y += step){
dc->MoveTo(point);
dc->LineTo(point.x + 75, point.y);
}
point = save;
for(int i = 0; i <= 3; ++i, point.x += step){
dc->MoveTo(point);
dc->LineTo(point.x, point.y + 75);
}
for(int i = 0; i < 9; ++i){
int num = status / ten[i] % 10;
int x = i % 3, y = i / 3;
if(num){
char str[10];
sprintf(str, "%d", num);
dc->TextOut(save.x + x * step + 8, save.y + y * step + 5, str);
}
}
}
*/
BOOL CGraph::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加額外的初始化
char str[50];
CString res;
sprintf(str, " %09d", path[0]);
res += str;
for(int i = 1; i < path.size(); ++i){
if(i % 5 == 0)
res += "\r\n\r\n\r\n";
sprintf(str, " -----> %09d", path[i]);
res += str;
}
SetDlgItemText(IDC_GRAPH, res);
return TRUE; // return TRUE unless you set the focus to a control
// 異常: OCX 屬性頁應返回 FALSE
}
/*
void CGraph::OnPaint(){
//CPaintDC dc(this); // device context for painting
CDC *dc = GetDlgItem(IDC_GRAPH)->GetWindowDC();
int i;
CPoint begin(5, 5), step_h(step + len, 0), step_v(0, step + len), save;
static CPen pen(PS_SOLID, 2, RGB(255, 0 , 0));
dc->SelectObject(&pen);
i = 0;
save.x = begin.x;
save.y = begin.y;
do{
CPoint tmp;
tmp.x = begin.x;
tmp.y = begin.y;
ShowNode(path[i], begin, dc);
if( (i + 1) % 6 == 0){
step_h.x *= -1;
begin += step_v;
}else
begin += step_h;
if(i > 0){
paintLine(save, tmp, dc);
save.x = tmp.x;
save.y = tmp.y;
}
i++;
}while(i < path.size() );
}*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -