messageviewerdialog.cpp

来自「本代码为使用vc平台开发stk软件x插件的一个范例。」· C++ 代码 · 共 91 行

CPP
91
字号
/******************************************************************************/
/*****       Copyright 2004-2004, Analytical Graphics, Incorporated.      *****/
/******************************************************************************/
// MessageViewerDialog.cpp : implementation file
//

#include "stdafx.h"
#include "cppmdi.h"
#include "MessageViewerDialog.h"
#include "agpickinfodata.h"


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

/////////////////////////////////////////////////////////////////////////////
// CMessageViewerDialog dialog


CMessageViewerDialog::CMessageViewerDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CMessageViewerDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMessageViewerDialog)
	//}}AFX_DATA_INIT
}


void CMessageViewerDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMessageViewerDialog)
	DDX_Control(pDX, IDC_MESSAGE_TEXT, m_MessageText);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMessageViewerDialog, CDialog)
	//{{AFX_MSG_MAP(CMessageViewerDialog)
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMessageViewerDialog Public Methods

void CMessageViewerDialog::AddMessage(/*const*/ CAgPickInfoData& pickInfoData)
{
	CString			msg;

	msg.Format("Selected Object: %s, Lat: %f, Lon: %f, Alt:%f",
					(pickInfoData.GetObjPath() != "") ? pickInfoData.GetObjPath() : "none",
					pickInfoData.GetLat(),
					pickInfoData.GetLon(),
					pickInfoData.GetAlt());

	AddMessage(msg);
}

void CMessageViewerDialog::AddMessage(const CString& msg)
{
	m_MessageText.SetSel(-1, -1);
	m_MessageText.ReplaceSel(msg + "\n");

	UpdateData(FALSE);
}

// OnSize
//  make the rich edit control take up the entire dialog
void CMessageViewerDialog::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	
	if (nType != SIZE_MINIMIZED && m_MessageText)
	{
		RECT rectMsgView;
		GetClientRect(&rectMsgView);

		m_MessageText.MoveWindow(&rectMsgView);
	}
}

/******************************************************************************/
/*****       Copyright 2004-2004, Analytical Graphics, Incorporated.      *****/
/******************************************************************************/


⌨️ 快捷键说明

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