• 大小: 156KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-18
  • 语言: C/C++
  • 标签: 图像  坐标  选点  MFC  

资源简介

基于MFC的查看图像坐标选点程序,当导入一副图像时,鼠标所指位置会在主框架窗口会产生其在图像坐标中的横纵值,记录该点在图像中的水平和竖直坐标位置,达到选点的目的。

资源截图

代码片段和文件信息


// MainFrm.cpp : CMainframe 类的实现
//

#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           // 状态行指示器
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};

// CMainframe 构造/析构

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;
// 基于持久值设置视觉管理器和样式
OnApplicationLook(theApp.m_nAppLook);

if (!m_wndMenuBar.Create(this))
{
TRACE0(“未能创建菜单栏\n“);
return -1;      // 未能创建
}

m_wndMenuBar.SetPanestyle(m_wndMenuBar.GetPanestyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);

// 防止菜单栏在激活时获得焦点
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(“未能创建工具栏\n“);
return -1;      // 未能创建
}

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(“未能创建状态栏\n“);
return -1;      // 未能创建
}
m_wndStatusBar.SetIndicators(indicators sizeof(indicators)/sizeof(UINT));

// TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           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

评论

共有 条评论