onwatertargetview.cpp

来自「自己做的一个雷达仿真的程序」· C++ 代码 · 共 164 行

CPP
164
字号
// OnwaterTargetView.cpp : implementation file
//

#include "stdafx.h"
#include "multarget.h"
#include "OnwaterTargetView.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

/////////////////////////////////////////////////////////////////////////////
// COnwaterTargetView

IMPLEMENT_DYNCREATE(COnwaterTargetView, CFormView)

COnwaterTargetView::COnwaterTargetView()
	: CFormView(COnwaterTargetView::IDD)
{
	//{{AFX_DATA_INIT(COnwaterTargetView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

COnwaterTargetView::~COnwaterTargetView()
{
}

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


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

/////////////////////////////////////////////////////////////////////////////
// COnwaterTargetView diagnostics

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

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

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

void COnwaterTargetView::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
}

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

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

void COnwaterTargetView::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 + =
减小字号Ctrl + -
显示快捷键?