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

📄 shipinfo.cpp

📁 Viaual C++实战演练一书的源代码,对于C++程序员有实际的借鉴意义.
💻 CPP
字号:
// ShipInfo.cpp : implementation file
//

#include "stdafx.h"
#include "demo3.h"
#include "ShipInfo.h"
#include "Dynamic.h"

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

/////////////////////////////////////////////////////////////////////////////
// CShipInfo dialog


CShipInfo::CShipInfo(CWnd* pParent /*=NULL*/)
	: CDialog(CShipInfo::IDD, pParent)
{
	//{{AFX_DATA_INIT(CShipInfo)
	m_fHs = 0.0f;
	m_strBp = _T("");
	m_fHx = 0.0f;
	m_fJing = 0.0f;
	m_strTime = _T("");
	m_fWei = 0.0f;
	//}}AFX_DATA_INIT
}


void CShipInfo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShipInfo)
	DDX_Text(pDX, IDC_EDIT_HS, m_fHs);
	DDV_MinMaxFloat(pDX, m_fHs, 0.f, 100.f);
	DDX_Text(pDX, IDC_EDIT_BP, m_strBp);
	DDX_Text(pDX, IDC_EDIT_HX, m_fHx);
	DDV_MinMaxFloat(pDX, m_fHx, 0.f, 360.f);
	DDX_Text(pDX, IDC_EDIT_J, m_fJing);
	DDV_MinMaxFloat(pDX, m_fJing, -180.f, 180.f);
	DDX_Text(pDX, IDC_EDIT_T, m_strTime);
	DDX_Text(pDX, IDC_EDIT_W, m_fWei);
	DDV_MinMaxFloat(pDX, m_fWei, -90.f, 90.f);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CShipInfo, CDialog)
	//{{AFX_MSG_MAP(CShipInfo)
	ON_BN_CLICKED(ID_CLOSE, OnClose)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CShipInfo& 	CShipInfo::operator=(CShip* ship)
{
	m_fHs = ship->m_fV;
	m_fHx = ship->m_fCourse;
	m_fJing = ship->m_fX0;
	m_fWei = ship->m_fY0;
	m_strBp = ship->m_strScutcheon;

	struct tm *today;
	if(today= localtime( &(ship->m_tTime) ))
	{
		m_strTime.Format("%02d点%02d分%02d秒", today->tm_hour-today->tm_isdst, today->tm_min, today->tm_sec);
	}

	return *this;
}

/////////////////////////////////////////////////////////////////////////////
// CShipInfo message handlers

void CShipInfo::OnClose() 
{
	// TODO: Add your control notification handler code here
	if(this)
		delete this;
}

⌨️ 快捷键说明

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