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

📄 tviview.cpp

📁 该代码用于计算波段的TVI值,该代码来源于作业程序,属于实验程序
💻 CPP
字号:
// TVIView.cpp : implementation of the CTVIView class
//

#include "stdafx.h"
#include "TVI.h"
#include "MainFrm.h"
#include "TVIDoc.h"
#include "TVIView.h"
#include"InputnThre.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTVIView

IMPLEMENT_DYNCREATE(CTVIView, CView)

BEGIN_MESSAGE_MAP(CTVIView, CView)
	//{{AFX_MSG_MAP(CTVIView)
	ON_WM_LBUTTONDOWN()
	ON_COMMAND(ID_MENUITEM32771, OnMenuitem32771)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTVIView construction/destruction

CTVIView::CTVIView()
{
	// TODO: add construction code here
	nThreshold =20;

}

CTVIView::~CTVIView()
{
}

BOOL CTVIView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTVIView drawing

void CTVIView::OnDraw(CDC* pDC)
{
	CTVIDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CRect rect;
	GetClientRect(&rect);
	int nWidth,nHeight;
	nWidth = pDoc->m_envyImage.GetCol();
	nHeight = pDoc->m_envyImage.GetRow();
	pDoc->m_envyImage.DrawImage(0,0,nWidth,nHeight,pDC,0,0,nWidth,nHeight,SRCCOPY);
}

/////////////////////////////////////////////////////////////////////////////
// CTVIView diagnostics

#ifdef _DEBUG
void CTVIView::AssertValid() const
{
	CView::AssertValid();
}

void CTVIView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CTVIDoc* CTVIView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTVIDoc)));
	return (CTVIDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTVIView message handlers

/*
void CTVIView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
    CString str;
	CMainFrame* pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CStatusBar* pStatus=&pFrame->m_wndStatusBar;
	if(pStatus){
		str.Format("x=d%",point.x);
		pStatus->SetPaneText(0,str);
		str.Format("y=d%",point.y);
		pStatus->SetPaneText(1,str);

	}
}*/


void CTVIView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
    int x,y;
	x=point.x;
	y=point.y;
	CString str;
	str.Format("x=%d,y=%d",x,y);
	MessageBox(str,NULL,MB_OK);
    int nColor;
	CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
	CTVIDoc* pDoc = (CTVIDoc*)pFrame->GetActiveDocument();
	nColor = 1;
	pDoc->m_envyImage.CreateDisplaRegionGrowImage(1, 2, 3,nColor,point,nThreshold);
	pDoc->UpdateAllViews(FALSE);
    
}

void CTVIView::OnMenuitem32771() 
{
	 // TODO: Add your command handler code here
	CInputnThre InputnThreDlg;
	if(InputnThreDlg.DoModal()==IDOK)
	{
		nThreshold=InputnThreDlg.m_nThreshold;
	}
     
}

⌨️ 快捷键说明

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