資源簡介
周末寫了兩個程序
1.一個sudo游戲的打譜和自動計算結果的程序
[url=http://topic.csdn.net/u/20121013/18/551a0cf3-792a-4fe2-8d15-be16761a0d4c.html][/url]
2.由于用戶交互的需要 需要畫一個矩形,這個矩形可能不是跟x y坐標平行的 可能是斜的
用戶交互的時候 先點一個點拖動的時候 確定一條邊 再拖動第三點的時候, 根據第三點到這條邊的距離確定唯一的矩形.
[img=http://sharego.org/triangle.png][/img]
分享下

代碼片段和文件信息
//?MainFrm.cpp?:?implementation?of?the?CMainframe?class
//
#include?“stdafx.h“
#include?“Rect.h“
#include?“MainFrm.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CMainframe
IMPLEMENT_DYNCREATE(CMainframe?CframeWnd)
BEGIN_MESSAGE_MAP(CMainframe?CframeWnd)
//{{AFX_MSG_MAP(CMainframe)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code?!
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static?UINT?indicators[]?=
{
ID_SEPARATOR???????????//?status?line?indicator
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?construction/destruction
CMainframe::CMainframe()
{
//?TODO:?add?member?initialization?code?here
}
CMainframe::~CMainframe()
{
}
int?CMainframe::OnCreate(LPCREATESTRUCT?lpCreateStruct)
{
if?(CframeWnd::OnCreate(lpCreateStruct)?==?-1)
return?-1;
if?(!m_wndToolBar.CreateEx(this?TBstyle_FLAT?WS_CHILD?|?WS_VISIBLE?|?CBRS_TOP
|?CBRS_GRIPPER?|?CBRS_TOOLTIPS?|?CBRS_FLYBY?|?CBRS_SIZE_DYNAMIC)?||
!m_wndToolBar.LoadToolBar(IDR_MAINframe))
{
TRACE0(“Failed?to?create?toolbar\n“);
return?-1;??????//?fail?to?create
}
if?(!m_wndStatusBar.Create(this)?||
!m_wndStatusBar.SetIndicators(indicators
??sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“Failed?to?create?status?bar\n“);
return?-1;??????//?fail?to?create
}
//?TODO:?Delete?these?three?lines?if?you?don‘t?want?the?toolbar?to
//??be?dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return?0;
}
BOOL?CMainframe::PreCreateWindow(CREATESTRUCT&?cs)
{
if(?!CframeWnd::PreCreateWindow(cs)?)
return?FALSE;
//?TODO:?Modify?the?Window?class?or?styles?here?by?modifying
//??the?CREATESTRUCT?cs
return?TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?diagnostics
#ifdef?_DEBUG
void?CMainframe::AssertValid()?const
{
CframeWnd::AssertValid();
}
void?CMainframe::Dump(CDumpContext&?dc)?const
{
CframeWnd::Dump(dc);
}
#endif?//_DEBUG
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?message?handlers
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????48640??2012-10-14?09:32??Rect.opt
?????文件???????1594??2012-10-14?09:32??Rect.plg
?????文件??????10519??2012-10-13?23:37??Rect.rc
?????文件???????1702??2012-10-13?23:37??RectDoc.cpp
?????文件???????1453??2012-10-13?23:37??RectDoc.h
?????文件???????5422??2012-10-14?01:47??RectView.cpp
?????文件???????2109??2012-10-14?01:46??RectView.h
?????文件????????490??2012-10-13?23:37??Resource.h
?????文件????????206??2012-10-13?23:37??StdAfx.cpp
?????文件???????1054??2012-10-13?23:37??StdAfx.h
?????文件??????32768??2012-10-14?09:32??Release\Rect.exe
?????文件???????1078??2012-10-13?23:37??res\Rect.ico
?????文件????????396??2012-10-13?23:37??res\Rect.rc2
?????文件???????1078??2012-10-13?23:37??res\RectDoc.ico
?????文件???????1078??2012-10-13?23:37??res\Toolbar.bmp
?????文件???????2505??2012-10-13?23:37??MainFrm.cpp
?????文件???????1581??2012-10-13?23:37??MainFrm.h
?????文件???????4263??2012-10-13?23:37??ReadMe.txt
?????文件??????28796??2012-10-13?23:38??Rect.aps
?????文件???????2246??2012-10-14?01:45??Rect.clw
?????文件???????4177??2012-10-14?01:35??Rect.cpp
?????文件???????4517??2012-10-14?00:43??Rect.dsp
?????文件????????533??2012-10-13?23:37??Rect.dsw
?????文件???????1334??2012-10-13?23:37??Rect.h
?????文件??????74752??2012-10-14?09:32??Rect.ncb
?????目錄??????????0??2012-10-14?09:32??Release
?????目錄??????????0??2012-10-13?23:37??res
-----------?---------??----------?-----??----
???????????????234291????????????????????27
............此處省略0個文件信息
- 上一篇:bootstrap超詳細教程
- 下一篇:cmd批處理命令幫助文檔
評論
共有 條評論