⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rowimagedlg.cpp

📁 opencv+mfc打开AVI文件
💻 CPP
字号:
// RowImageDlg.cpp : implementation file
//

#include "stdafx.h"
#include "OpenCVMFCF.h"
#include "RowImageDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// RowImageDlg dialog


RowImageDlg::RowImageDlg(CWnd* pParent /*=NULL*/)
	: CDialog(RowImageDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(RowImageDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void RowImageDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(RowImageDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(RowImageDlg, CDialog)
	//{{AFX_MSG_MAP(RowImageDlg)
	ON_WM_TIMER()
	ON_WM_PAINT()
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// RowImageDlg message handlers

void RowImageDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	COpenCVMFCFDlg* dlg=(COpenCVMFCFDlg*)GetParent();
	CDC *cdc = GetDC();
	CRect rect ; 
	GetClientRect(&rect);
	HDC hdc = cdc->GetSafeHdc();
	if ( dlg->capture != 0 )
	{
		dlg->frame = cvQueryFrame( dlg->capture );
		if ( dlg->frame )
		{
			CvvImage img;
			img.CopyOf(dlg->frame);
			img.DrawToHDC(hdc,&rect);
		}
		else
		{
			EndDialog(0);
			PostNcDestroy();
		}
	}
	CDialog::OnTimer(nIDEvent);
}

void RowImageDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	
	// Do not call CDialog::OnPaint() for painting messages
}

BOOL RowImageDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	SetTimer(1,20,NULL); 
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void RowImageDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
	
}

void RowImageDlg::PostNcDestroy() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CDialog::PostNcDestroy();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -