www.pudn.com > GPS ToolKit Pro.rar > SnrBarPRN.cpp


// SnrBarPRN.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "GTKTestPanel.h" 
#include "SnrBarPRN.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
#define FIXSATCOLOR RGB(0x00, 0xC0, 0x00) 
#define SATINVIEWCOLOR RGB(0xAA, 0xAA, 0xAA) 
#define SATTEXTCOLOR RGB(0xFF, 0xFF, 0xFF) 
 
///////////////////////////////////////////////////////////////////////////// 
// CSnrBarPRN 
 
CSnrBarPRN::CSnrBarPRN() : m_prn(-1) 
{ 
} 
 
CSnrBarPRN::~CSnrBarPRN() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CSnrBarPRN, CStatic) 
	//{{AFX_MSG_MAP(CSnrBarPRN) 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSnrBarPRN message handlers 
 
void CSnrBarPRN::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	 
	// Set satellite name string 
	CString strPRN; 
	char lpszPRN[3]; 
 
	if(m_prn < 0) 
	{ 
		// Clear client area 
		RECT clientRect; 
		GetClientRect(&clientRect); 
		CBrush bgBrush(GetSysColor(COLOR_BTNFACE)); 
		dc.FillRect(&clientRect, &bgBrush); 
	} 
	else 
	{ 
		dc.SetTextColor(SATTEXTCOLOR); 
		dc.SelectStockObject(DEFAULT_GUI_FONT); 
 
		itoa(m_prn, lpszPRN, 10); 
		if(m_prn < 10) 
		{ 
			strPRN = CString("0") + lpszPRN; 
		} 
		else 
		{ 
			strPRN = lpszPRN; 
		} 
 
		// Set background color for this satellite  
		if(bIsFixSat) 
		{ 
			dc.SetBkColor(FIXSATCOLOR); 
		} 
		else 
		{ 
			dc.SetBkColor(SATINVIEWCOLOR); 
		} 
 
		// Draw SNR bars 
		dc.ExtTextOut(6, 0, ETO_OPAQUE, NULL, strPRN, NULL); 
	} 
	 
	 
	// Do not call CStatic::OnPaint() for painting messages 
} 
 
void CSnrBarPRN::DrawSnrBarPRN() 
{ 
	Invalidate(); 
}