資源簡(jiǎn)介
基于MFC的查看圖像坐標(biāo)選點(diǎn)程序,當(dāng)導(dǎo)入一副圖像時(shí),鼠標(biāo)所指位置會(huì)在主框架窗口會(huì)產(chǎn)生其在圖像坐標(biāo)中的橫縱值,記錄該點(diǎn)在圖像中的水平和豎直坐標(biāo)位置,達(dá)到選點(diǎn)的目的。

代碼片段和文件信息
//?MainFrm.cpp?:?CMainframe?類的實(shí)現(xiàn)
//
#include?“stdafx.h“
#include?“ViewPoint.h“
#include?“MainFrm.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
//?CMainframe
IMPLEMENT_DYNCREATE(CMainframe?CframeWndEx)
const?int??iMaxUserToolbars?=?10;
const?UINT?uiFirstUserToolBarId?=?AFX_IDW_CONTROLBAR_FIRST?+?40;
const?UINT?uiLastUserToolBarId?=?uiFirstUserToolBarId?+?iMaxUserToolbars?-?1;
BEGIN_MESSAGE_MAP(CMainframe?CframeWndEx)
ON_WM_CREATE()
ON_COMMAND(ID_VIEW_CUSTOMIZE?&CMainframe::OnViewCustomize)
ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR?&CMainframe::OnToolbarCreateNew)
ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000?ID_VIEW_APPLOOK_WINDOWS_7?&CMainframe::OnApplicationLook)
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000?ID_VIEW_APPLOOK_WINDOWS_7?&CMainframe::OnUpdateApplicationLook)
END_MESSAGE_MAP()
static?UINT?indicators[]?=
{
ID_SEPARATOR???????????//?狀態(tài)行指示器
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
//?CMainframe?構(gòu)造/析構(gòu)
CMainframe::CMainframe()
{
//?TODO:?在此添加成員初始化代碼
theApp.m_nAppLook?=?theApp.GetInt(_T(“ApplicationLook“)?ID_VIEW_APPLOOK_VS_2008);
}
CMainframe::~CMainframe()
{
}
int?CMainframe::OnCreate(LPCREATESTRUCT?lpCreateStruct)
{
if?(CframeWndEx::OnCreate(lpCreateStruct)?==?-1)
return?-1;
BOOL?bNameValid;
//?基于持久值設(shè)置視覺(jué)管理器和樣式
OnApplicationLook(theApp.m_nAppLook);
if?(!m_wndMenuBar.Create(this))
{
TRACE0(“未能創(chuàng)建菜單欄\n“);
return?-1;??????//?未能創(chuàng)建
}
m_wndMenuBar.SetPanestyle(m_wndMenuBar.GetPanestyle()?|?CBRS_SIZE_DYNAMIC?|?CBRS_TOOLTIPS?|?CBRS_FLYBY);
//?防止菜單欄在激活時(shí)獲得焦點(diǎn)
CMFCPopupMenu::SetForceMenuFocus(FALSE);
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(theApp.m_bHiColorIcons???IDR_MAINframe_256?:?IDR_MAINframe))
{
TRACE0(“未能創(chuàng)建工具欄\n“);
return?-1;??????//?未能創(chuàng)建
}
RECT?rt;
rt.left?=?300;
rt.top?=?10;
rt.bottom?=?30;
rt.right?=?740;
pEdit?=?new?CEdit;
/* pButton->Create(?_T(“Source?data“)??WS_CHILD|WS_VISIBLE?rtthis?9000?);*/
pEdit->Create(WS_CHILD|WS_VISIBLE|WS_BORDER?rtthis?9000?);
// pEdit->EnableWindow(?FALSE?);
pEdit->ShowWindow(SW_SHOW);
pEdit->UpdateWindow();
CString?strToolBarName;
bNameValid?=?strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
ASSERT(bNameValid);
m_wndToolBar.SetWindowText(strToolBarName);
CString?strCustomize;
bNameValid?=?strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
m_wndToolBar.EnableCustomizeButton(TRUE?ID_VIEW_CUSTOMIZE?strCustomize);
//?允許用戶定義的工具欄操作:
InitUserToolbars(NULL?uiFirstUserToolBarId?uiLastUserToolBarId);
if?(!m_wndStatusBar.Create(this))
{
TRACE0(“未能創(chuàng)建狀態(tài)欄\n“);
return?-1;??????//?未能創(chuàng)建
}
m_wndStatusBar.SetIndicators(indicators?sizeof(indicators)/sizeof(UINT));
//?TODO:?如果您不希望工具欄和菜單欄可停靠,請(qǐng)刪除這五行
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-09-23?21:08??ViewPoint\
?????目錄???????????0??2014-09-23?21:08??ViewPoint\ViewPoint\
?????文件????????9029??2014-08-04?16:14??ViewPoint\ViewPoint\MainFrm.cpp
?????文件????????1109??2014-08-04?16:14??ViewPoint\ViewPoint\MainFrm.h
?????文件????????3530??2014-08-04?14:49??ViewPoint\ViewPoint\ReadMe.txt
?????文件????????1319??2014-08-04?14:49??ViewPoint\ViewPoint\Resource.h
?????文件????????7976??2009-08-31?03:59??ViewPoint\ViewPoint\UserImages.bmp
?????文件??????111076??2014-08-04?14:51??ViewPoint\ViewPoint\ViewPoint.aps
?????文件????????5108??2014-08-04?15:12??ViewPoint\ViewPoint\ViewPoint.cpp
?????文件?????????671??2014-08-04?14:49??ViewPoint\ViewPoint\ViewPoint.h
?????文件???????24844??2014-08-04?14:49??ViewPoint\ViewPoint\ViewPoint.rc
?????文件????????6276??2014-08-04?15:02??ViewPoint\ViewPoint\ViewPoint.vcxproj
?????文件????????2733??2014-08-04?14:49??ViewPoint\ViewPoint\ViewPoint.vcxproj.filters
?????文件?????????143??2014-08-04?14:49??ViewPoint\ViewPoint\ViewPoint.vcxproj.user
?????文件????????2774??2014-08-04?15:54??ViewPoint\ViewPoint\ViewPointDoc.cpp
?????文件?????????929??2014-08-04?15:07??ViewPoint\ViewPoint\ViewPointDoc.h
?????文件????????6520??2014-08-22?22:34??ViewPoint\ViewPoint\ViewPointView.cpp
?????文件????????1717??2014-08-15?14:15??ViewPoint\ViewPoint\ViewPointView.h
?????目錄???????????0??2014-09-23?21:07??ViewPoint\ViewPoint\res\
?????文件????????1078??2009-08-31?02:31??ViewPoint\ViewPoint\res\Toolbar.bmp
?????文件????????5816??2009-08-31?03:59??ViewPoint\ViewPoint\res\Toolbar256.bmp
?????文件???????67777??2009-08-31?02:31??ViewPoint\ViewPoint\res\ViewPoint.ico
?????文件?????????674??2014-08-04?14:49??ViewPoint\ViewPoint\res\ViewPoint.rc2
?????文件????????4710??2009-08-31?02:31??ViewPoint\ViewPoint\res\ViewPointDoc.ico
?????文件?????????142??2014-08-04?14:49??ViewPoint\ViewPoint\stdafx.cpp
?????文件????????1632??2014-08-04?14:49??ViewPoint\ViewPoint\stdafx.h
?????文件?????????234??2014-08-04?14:49??ViewPoint\ViewPoint\targetver.h
?????文件?????????894??2014-08-04?14:49??ViewPoint\ViewPoint.sln
評(píng)論
共有 條評(píng)論