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

📄 unwatertargetview.cpp

📁 自己做的一个雷达仿真的程序
💻 CPP
字号:
// UnwaterTargetView.cpp : implementation file
//

#include "stdafx.h"
#include "multarget.h"
#include "UnwaterTargetView.h"
#include "MulTargetDoc.h"
#include "LdxxDlg.h"
#include "WjcshDlg.h"
#include "AirView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CUnwaterTargetView

IMPLEMENT_DYNCREATE(CUnwaterTargetView, CFormView)

CUnwaterTargetView::CUnwaterTargetView()
	: CFormView(CUnwaterTargetView::IDD)
{
	//{{AFX_DATA_INIT(CUnwaterTargetView)
	
	//}}AFX_DATA_INIT
}

CUnwaterTargetView::~CUnwaterTargetView()
{
}

void CUnwaterTargetView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CUnwaterTargetView)
	
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CUnwaterTargetView, CFormView)
	//{{AFX_MSG_MAP(CUnwaterTargetView)
	ON_WM_PAINT()
	ON_COMMAND(ID_LDXX, OnLdxx)
	ON_COMMAND(ID_JTXX, OnJtxx)
	ON_COMMAND(ID_MBSHC, OnMbshc)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUnwaterTargetView diagnostics

#ifdef _DEBUG
void CUnwaterTargetView::AssertValid() const
{
	CFormView::AssertValid();
}

void CUnwaterTargetView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CUnwaterTargetView message handlers
CMulTargetDoc* CUnwaterTargetView::GetDocument()
{
  ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMulTargetDoc)));
	return (CMulTargetDoc*)m_pDocument;
}

void CUnwaterTargetView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
		CClientDC  clpDC(this);
	//视图区

	CRect cClientRect;
	GetClientRect(&cClientRect);
    
	//扫描区
	CRect SmRect(0,0,cClientRect.CenterPoint().x*1.1,cClientRect.CenterPoint().y*1.3);
    m_cx=SmRect.CenterPoint().x;  //中心点横坐标
	m_cy=SmRect.CenterPoint().y;  //中心点纵坐标
	
	
	m_r=cClientRect.CenterPoint().y*0.65;             //半径
    
	
	//定义白色画笔
	CPen *pOld,pYellow; 
	pYellow.CreatePen(PS_DASH,4,RGB(0,10,195));  
	pOld=clpDC.SelectObject(&pYellow);  
	
	
    //定义黑色刷子
	CBrush fillbr(RGB(12,0,0)),*brOld;
	brOld=clpDC.SelectObject(&fillbr);
	
	
	clpDC.FillRect(SmRect,&fillbr);//
	CRect Ellipserect(m_cx,m_cy,m_cx,m_cy);
    Ellipserect.InflateRect(m_r,m_r);
	clpDC.Ellipse(Ellipserect);
	
	pYellow.DeleteObject();
	pYellow.CreatePen(PS_DASH,1,RGB(255,255,255));
    pOld=clpDC.SelectObject(&pYellow);
	//同心圆
	
	for(int i=8;i>0;i--)
	
	{   CRect Ellipserect(m_cx,m_cy,m_cx,m_cy);
		Ellipserect.InflateRect(0.11*i*m_r,0.11*i*m_r);

		clpDC.Ellipse(Ellipserect);
	}
	// Do not call CFormView::OnPaint() for painting messages
}

//DEL void CUnwaterTargetView::OnButton1() 
//DEL {
//DEL 	// TODO: Add your control notification handler code here
//DEL 	UpdateData(TRUE);
//DEL 	CMulTargetDoc *pDoc=GetDocument();
//DEL 	pDoc->m_int=m_input;
//DEL }

void CUnwaterTargetView::OnLdxx() 
{
	// TODO: Add your command handler code here
	CLdxxDlg *pDlg=NULL;
 	if(!pDlg)
 	{
		pDlg=new CLdxxDlg(this);
 	ASSERT(pDlg);
 	}
   pDlg->DoModal();
}

void CUnwaterTargetView::OnJtxx() 
{
	// TODO: Add your command handler code here
		CWjcshDlg *pDlg=NULL;
 	if(!pDlg)
 	{
		pDlg=new CWjcshDlg(this);
 	ASSERT(pDlg);
 	}
   pDlg->DoModal();
}

void CUnwaterTargetView::OnMbshc() 
{
	// TODO: Add your command handler code here
	CMulTargetDoc *pDoc=GetDocument();
	pDoc->m_T=pDoc->m_pt1ldzq;
	
	CAirView *pDlg=NULL;
 	if(!pDlg)
 	{
		pDlg=new CAirView(this);
 	ASSERT(pDlg);
 	}
   pDlg->DoModal();
}

⌨️ 快捷键说明

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