Răsfoiți Sursa

调试成功绿色,失败红色。

JeffWang 3 ani în urmă
părinte
comite
5293265585

+ 36 - 0
Source/OGCAssistTool/OGCAssistTool/FontSize.cpp

@@ -0,0 +1,36 @@
+#include "stdafx.h"
+#include "FontSize.h"
+
+/***************************************************************************************/
+// GetFontPointSize
+int GetFontPointSize(int iHeight)
+{
+    HDC hDC = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
+    ASSERT(hDC);
+
+    int icyPixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSY);
+    DeleteDC(hDC);
+
+    int iPointSize = MulDiv(iHeight, 72, icyPixelsPerInch);
+    if(iPointSize < 0)
+    {
+        iPointSize = -iPointSize;
+    }
+
+    return iPointSize;
+}
+
+/***************************************************************************************/
+// GetFontHeight
+int GetFontHeight(int iPointSize)
+{
+    HDC hDC = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
+    ASSERT(hDC);
+
+    int icyPixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSY);
+    DeleteDC(hDC);
+
+    int iHeight = -MulDiv(iPointSize, icyPixelsPerInch, 72);
+
+    return iHeight;
+}

+ 25 - 0
Source/OGCAssistTool/OGCAssistTool/FontSize.h

@@ -0,0 +1,25 @@
+/*************************************************************************************
+ * FontSize.h
+ *
+ * 作者: 雷登似
+ * 公司: TCL多媒体科技控股有限公司
+ * 版本: 0.01
+ * 编程日期: 2010-04-21
+ * 联系方式: wp2.leids@tcl.com / 0752-3270423(81423)
+ *
+ * 功能: 获取字体大小
+ * 说明: 本软件释放给TCL公司, 只要你喜欢, 在TCL公司内部可以免费使用, 但在使用过程中
+ *       你必须保证此软件的说明信息完整!
+ *
+ * 此软件的最终解释权归原作者拥有, 作者不对软件的分发和使用负责, 如果你因使用此软
+ * 件而造成的任何损失或商业风险均由使用者自己承担所有责任.
+ *
+ *************************************************************************************/
+
+#ifndef __FONT_SIZE_H__
+#define __FONT_SIZE_H__
+
+int GetFontPointSize(int iHeight);
+int GetFontHeight(int iPointSize);
+
+#endif

+ 1 - 0
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.rc

@@ -140,6 +140,7 @@ BEGIN
     PUSHBUTTON      "²âÊÔ",BTN_TEST,669,18,50,14
     PUSHBUTTON      "Á¬½ÓÉ豸",BTN_CONNECT,612,295,50,14
     PUSHBUTTON      "¼ÓÔØÊý¾Ý",BTN_LOAD_DATA,216,18,40,14
+    CTEXT           "",LABLE_RESULT,146,294,59,15
 END
 
 PAGE_LOG DIALOGEX 0, 0, 732, 322

+ 24 - 0
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.vcproj

@@ -431,6 +431,14 @@
 				RelativePath=".\CeXDib.h"
 				>
 			</File>
+			<File
+				RelativePath=".\FontSize.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\FontSize.h"
+				>
+			</File>
 			<File
 				RelativePath=".\HyperLink.cpp"
 				>
@@ -447,6 +455,14 @@
 				RelativePath=".\ShadeButtonST.h"
 				>
 			</File>
+			<File
+				RelativePath=".\SubLabel.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SubLabel.h"
+				>
+			</File>
 			<File
 				RelativePath=".\WinXPButtonST.cpp"
 				>
@@ -455,6 +471,14 @@
 				RelativePath=".\WinXPButtonST.h"
 				>
 			</File>
+			<File
+				RelativePath=".\XColorStatic.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\XColorStatic.h"
+				>
+			</File>
 		</Filter>
 		<File
 			RelativePath=".\ReadMe.txt"

+ 22 - 2
Source/OGCAssistTool/OGCAssistTool/PageDebug.cpp

@@ -41,6 +41,7 @@ void CPageDebug::DoDataExchange(CDataExchange* pDX)
 	DDX_Control(pDX, LIST_DEBUG_DATA, m_ctrlList);
 	DDX_Control(pDX, BTN_CONNECT, m_btnConnect);
 	DDX_Control(pDX, COMBO_ETYPE, m_cbDeltaEType);
+	DDX_Control(pDX, LABLE_RESULT, m_lable_result);
 }
 
 
@@ -98,6 +99,11 @@ BOOL CPageDebug::OnInitDialog()
 	GLOBAL::g_IOCP.SetCallBack(NULL, NULL, NULL, ReceiveProc);
 	SetDlgItemText(EDIT_LINE, GLOBAL::g_config.szLine);
 
+	m_lable_result.SetTransparent(TRUE);
+	m_lable_result.SetFontSize(13);
+	m_lable_result.SetFontName(_T("Arial"));
+	m_lable_result.SetFontBold();
+
 	HANDLE hThread = CreateThread(NULL, 0, ThreadGoProc, this, 0, &m_dwGoProcThreadId);
 	if ( hThread )
 		CloseHandle(hThread);
@@ -403,13 +409,18 @@ DWORD CPageDebug::ThreadGoProc(LPVOID lpParam)
 										TCHAR szDeltaValue[20] = {0};
 										_stprintf_s(szDeltaValue, _T("%0.3f"), dAVGValue);
 										m_pDlg->SetDlgItemText(EDIT_ARG_EVALUE, szDeltaValue);
+										m_pDlg->m_lable_result.SetTransparent(FALSE);
 										if ( bRet )
 										{
-
+											//m_pDlg->m_lable_result.SetBold(TRUE);
+											m_pDlg->m_lable_result.SetText(_T("³É¹¦"));
+											m_pDlg->m_lable_result.SetBkColor(COLOR_GREED);
 										}
 										else
 										{
-
+											//m_pDlg->m_lable_result.SetBold(TRUE);
+											m_pDlg->m_lable_result.SetText(_T("ʧ°Ü"));
+											m_pDlg->m_lable_result.SetBkColor(COLOR_RED);
 										}
 									}
 								}
@@ -473,6 +484,8 @@ void CPageDebug::OnBnClickedHijack()
 
 void CPageDebug::OnBnClickedTest()
 {
+	m_lable_result.SetText(_T(""));
+	m_lable_result.SetTransparent(TRUE);
 	if ( GLOBAL::g_procWndInfo.bHijackStatus && GLOBAL::g_procWndInfo.bConnectStatus )
 	{
 		CString strSN;
@@ -696,6 +709,13 @@ void CPageDebug::OnBnClickedLock()
 		GetDlgItem(COMBO_ETYPE)->EnableWindow(!bCheckLock);
 		GetDlgItem(EDIT_EVALUE)->EnableWindow(!bCheckLock);
 		GetDlgItem(SPIN_EVALUE)->EnableWindow(!bCheckLock);
+		CString strDelteValue;
+		GetDlgItemText(EDIT_EVALUE, strDelteValue);
+		if ( GLOBAL::IsDigitString(strDelteValue) != -1 )
+		{
+			GLOBAL::g_config.dDeltaEValue = _tstof(strDelteValue.GetString());
+			WritePrivateProfileString(_T("BATCH"), _T("EValue"), strDelteValue.GetString(), GLOBAL::g_szConfigFile);		
+		}
 	}
 	else
 	{

+ 2 - 0
Source/OGCAssistTool/OGCAssistTool/PageDebug.h

@@ -1,6 +1,7 @@
 #pragma once
 #include "afxcmn.h"
 #include "afxwin.h"
+#include "SubLabel.h"
 
 // ÏûÏ¢;
 #define WM_CONNECT_PRO			(WM_USER + 1001)
@@ -59,4 +60,5 @@ public:
 	static DWORD WINAPI ThreadGoProc(LPVOID lpParam);
 	afx_msg void OnCbnSelchangeEtype();
 	CComboBox m_cbDeltaEType;
+	CLabel m_lable_result;
 };

+ 1364 - 0
Source/OGCAssistTool/OGCAssistTool/SubLabel.cpp

@@ -0,0 +1,1364 @@
+// Label.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "SubLabel.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+BEGIN_MESSAGE_MAP(CLabel, CStatic)
+	//{{AFX_MSG_MAP(CLabel)
+	ON_WM_TIMER()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_SETCURSOR()
+	ON_WM_SYSCOLORCHANGE()
+	ON_WM_PAINT()
+	ON_WM_ERASEBKGND()
+	//}}AFX_MSG_MAP
+	ON_WM_CTLCOLOR_REFLECT()
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CLabel Version 1.2
+//
+// From now on I'll try to keep a log of fixes and enhancements...
+// 
+// The new feature were added due to the response of people.
+// All I ask is to all you programmers out there, is if you add, fix or
+// enhance this code, sent me a copy and I'll send the copy on to www.codeproject.com
+//
+// Happy Software Engineer :)
+// 
+// New features include:
+//
+// A. Support for 3D Fonts
+// B. Support for background transparency
+// C. More comments provided
+// D. If alignment is 'centered' and the window text is seperated by '\r\n'
+//	  the will be centered accordingly - requested by someone @ nasa ;)
+// E. Support for font rotation.
+// F. Respond to System Color Change
+// G. OnPaint improved performance - using Double Buffering Technique
+//
+// Thanks to:
+// Mark McDowell	- For suggestion on 'Increasing the flexibility of "hypertext" setting...'
+// Erich Ruth		- For suggestion on 'Font Rotation'
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CLabel Version 1.3
+//
+// A. Added SS_LEFTNOWORDWRAP to include wordwrap
+// B. Fix repainting problem 
+// C. Fix SetBkColor
+// D. Added SS_CENTER
+
+// Thanks to:
+// Marius						- Added styling problem.
+// Azing Vondeling & Broker		- Spotting painting Problem.
+// Mel Stober					- Back Color & SS_CENTER
+// 
+/////////////////////////////////////////////////////////////////////////////
+// CLabel Version 1.4
+//
+// A. Fix to transparency mode
+// B. Added new SetText3DHiliteColor to change the 3D Font face color - default is white.
+// 
+// Thanks to:
+// michael.groeger				- Spotting Transparency with other controls bug.
+//
+//
+/////////////////////////////////////////////////////////////////////////////
+// CLabel Version 1.5
+//
+// A. Sanity handle check
+// B. Support Interface Charset
+// C. Check compilition with _UNICODE
+// D. Fix hyperlink feature
+// E. Support default Dialog Font
+// F. Inclusion of SS_OWNERDRAW via control creation and subclassing
+// G. Modification to Text aligmnent code
+// H. New background gradient fill function
+// 
+// Thanks to:
+// Steve Kowald				- Using null handles 
+// Alan Chan				- Supporting International Windows
+// Dieter Fauth				- Request for default Dialog font
+// Herb Illfelder			- Text Alignment code
+// 
+/////////////////////////////////////////////////////////////////////////////
+// CLabel Version 1.6
+// Jeroen Roosendaal		- SetFont suggestion
+// Laurent					- Spotting SelectObject bugs
+// Bernie					- Fix PreCreateWindow bug
+// Jignesh I. Patel			- Added expanded tabs feature
+// Jim Farmelant 			- Fix SetText crash
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::CLabel
+//
+// Description:		Default contructor
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel::CLabel()
+{
+	m_crText = GetSysColor(COLOR_WINDOWTEXT);
+
+	// 1.1
+	m_hBackBrush = NULL;
+
+
+	m_crHiColor =		0;
+	m_crLoColor	=		0;
+
+	m_bTimer =			FALSE;
+	m_bState =			FALSE;
+	m_bTransparent =	FALSE;
+	m_Link =			LinkNone;
+	m_hCursor =			NULL;
+	m_Type =			None;
+	m_bFont3d =			FALSE;
+	m_bNotifyParent =	FALSE;
+	m_bToolTips =		FALSE;
+	m_bRotation =		FALSE;
+	m_fillmode =		Normal;
+	m_cr3DHiliteColor =	RGB(255,255,255);
+	m_strText =			_T("");
+	m_hwndBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::~CLabel
+//
+// Description:		
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+// NT ALMOND				15092000	1.5		Handle Check
+//////////////////////////////////////////////////////////////////////////
+CLabel::~CLabel()
+{
+	// Clean up
+	m_font.DeleteObject();
+	::DeleteObject(m_hwndBrush);
+
+	// Stop Checking complaining
+	if (m_hBackBrush)
+		::DeleteObject(m_hBackBrush);
+
+}
+
+void CLabel::UpdateSurface()
+{
+	CRect (rc);
+	GetWindowRect(rc);
+	RedrawWindow();
+
+	GetParent()->ScreenToClient(rc);
+	GetParent()->InvalidateRect(rc,TRUE);
+	GetParent()->UpdateWindow();
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::ReconstructFont
+//
+// Description:		Helper function to build font after it was changed
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			PROTECTED
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+void CLabel::ReconstructFont()
+{
+	m_font.DeleteObject();
+	BOOL bCreated = m_font.CreateFontIndirect(&m_lf);
+
+	ASSERT(bCreated);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::OnPaint
+//
+// Description:		Handles all the drawing code for the label
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			Called by Windows... not by USER
+//					Probably needs tiding up a some point.
+//					Different states will require this code to be reworked.
+//
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+// NT ALMOND				15092000	1.5		Handle Check
+// NT ALMOND				15092000	1.5		Alignment mods
+// NT ALMOND				15092000	1.5		Gradient Fill Mode
+// NT ALMOND				02072002	1.6		Fill SelectObject bugs
+// NT ALMOND				02072002	1.6		Added to expand tabs
+//////////////////////////////////////////////////////////////////////////
+
+void CLabel::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+	DWORD dwFlags = 0;
+
+	CRect rc;
+	GetClientRect(rc);
+	if (m_strText.IsEmpty())
+		GetWindowText(m_strText);
+	CBitmap bmp;
+
+
+	///////////////////////////////////////////////////////
+	//
+	// Set up for double buffering...
+	//
+	CDC* pDCMem;
+	CBitmap*	pOldBitmap = NULL;
+
+	if (!m_bTransparent)
+	{
+		pDCMem = new CDC;
+		pDCMem->CreateCompatibleDC(&dc);
+		bmp.CreateCompatibleBitmap(&dc,rc.Width(),rc.Height());
+		pOldBitmap = pDCMem->SelectObject(&bmp);
+	}
+	else
+	{
+		pDCMem = &dc;
+	}
+
+	UINT nMode = pDCMem->SetBkMode(TRANSPARENT);
+
+
+	COLORREF crText = pDCMem->SetTextColor(m_crText);
+	CFont *pOldFont = pDCMem->SelectObject(&m_font);
+
+
+	// Fill in backgound if not transparent
+	if (!m_bTransparent)
+	{
+		if (m_fillmode == Normal)
+		{
+			CBrush br;
+
+			if (m_hBackBrush != NULL)
+				br.Attach(m_hBackBrush);
+			else
+				br.Attach(m_hwndBrush);
+
+			pDCMem->FillRect(rc,&br);
+
+			br.Detach();
+		}
+		else // Gradient Fill
+		{
+			DrawGradientFill(pDCMem, &rc, m_crLoColor, m_crHiColor, 100);
+		}
+
+	}
+
+
+	// If the text is flashing turn the text color on
+	// then to the color of the window background.
+
+	LOGBRUSH lb;
+	ZeroMemory(&lb,sizeof(lb));
+
+	// Stop Checking complaining
+	if (m_hBackBrush)
+		::GetObject(m_hBackBrush,sizeof(lb),&lb);
+
+
+	// Something to do with flashing
+	if (!m_bState && m_Type == Text)
+	{
+		//ZeroMemory(&lb,sizeof(lb));
+		lb.lbColor = RGB(255,0,255);
+		pDCMem->SetTextColor(lb.lbColor);
+	}
+
+	DWORD style = GetStyle();
+
+	switch (style & SS_TYPEMASK)
+	{
+	case SS_RIGHT: 
+		dwFlags = DT_RIGHT | DT_WORDBREAK; 
+		break; 
+
+	case SS_CENTER: 
+		dwFlags = SS_CENTER | DT_WORDBREAK;
+		break;
+
+	case SS_LEFTNOWORDWRAP: 
+		dwFlags = DT_LEFT; 
+		break;
+
+	default: // treat other types as left
+	case SS_LEFT: 
+		dwFlags = DT_LEFT | DT_WORDBREAK; 
+		break;
+	}	
+
+
+	// Added to expand tabs...
+	if(m_strText.Find(_T('\t')) != -1)
+		dwFlags |= DT_EXPANDTABS;
+
+	// If the text centered make an assumtion that
+	// the will want to center verticly as well
+	if (style & SS_CENTERIMAGE)
+	{
+		dwFlags = DT_CENTER;
+
+		// Apply 
+		if (m_strText.Find(_T("\r\n")) == -1)
+		{
+			dwFlags |= DT_VCENTER;
+
+			// And because DT_VCENTER only works with single lines
+			dwFlags |= DT_SINGLELINE; 
+		}
+
+	}
+
+	//
+	// 3333   DDDDD
+	//     3  D    D
+	//   33   D     D    E F X 
+	//     3  D    D
+	// 3333   DDDDD
+	//
+	//
+	if (m_bRotation)
+	{
+		int nAlign = pDCMem->SetTextAlign (TA_BASELINE);
+
+		CPoint pt;
+		GetViewportOrgEx (pDCMem->m_hDC,&pt) ;
+		SetViewportOrgEx (pDCMem->m_hDC,rc.Width() / 2, rc.Height() / 2, NULL) ;
+		pDCMem->TextOut(0, 0, m_strText);
+		SetViewportOrgEx (pDCMem->m_hDC,pt.x / 2, pt.y / 2, NULL) ;
+		pDCMem->SetTextAlign (nAlign);
+	}
+	else
+	{
+		pDCMem->DrawText(m_strText, rc, dwFlags);
+		if (m_bFont3d)
+		{
+			pDCMem->SetTextColor(m_cr3DHiliteColor);
+
+			if (m_3dType == Raised)
+				rc.OffsetRect(-1,-1);
+			else
+				rc.OffsetRect(1,1);
+
+			pDCMem->DrawText(m_strText, rc, dwFlags);
+			m_3dType;
+
+		}
+	}
+
+	// Restore DC's State
+	pDCMem->SetBkMode(nMode);
+	pDCMem->SelectObject(pOldFont);
+	pDCMem->SetTextColor(crText);
+
+	if (!m_bTransparent)
+	{
+		dc.BitBlt(0, 0, rc.Width(), rc.Height(), pDCMem, 0, 0, SRCCOPY);
+		// continue DC restore 
+		pDCMem->SelectObject ( pOldBitmap ) ;
+		delete pDCMem;
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::OnTimer
+//
+// Description:		Used in conjunction with 'FLASH' functions
+//
+// INPUTS:          Windows API
+// 
+// RETURNS:         Windows API
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+void CLabel::OnTimer(UINT nIDEvent) 
+{
+
+	m_bState = !m_bState;
+
+	UpdateSurface();
+
+	CStatic::OnTimer(nIDEvent);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::OnSetCursor
+//
+// Description:		Used in conjunction with 'LINK' function
+//
+// INPUTS:          Windows API
+// 
+// RETURNS:         Windows API
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+BOOL CLabel::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
+{
+
+	if (m_hCursor)
+	{
+		::SetCursor(m_hCursor);
+		return TRUE;
+	}
+
+	return CStatic::OnSetCursor(pWnd, nHitTest, message);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::OnLButtonDown
+//
+// Description:		Called when a link is click on
+//
+// INPUTS:          Windows API
+// 
+// RETURNS:         Windows API
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+// NT ALMOND				02072002    1.6     Added Mail support
+//////////////////////////////////////////////////////////////////////////
+void CLabel::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+
+	if (!m_bNotifyParent) // Fix
+	{
+		CString strLink;
+
+		GetWindowText(strLink);
+		if (m_Link == HyperLink)
+		{
+			ShellExecute(NULL,_T("open"),m_sLink.IsEmpty() ? strLink : m_sLink,NULL,NULL,SW_SHOWNORMAL);
+		}
+		if (m_Link == MailLink)
+		{
+			strLink = _T("mailto:") + strLink;
+			ShellExecute( NULL, NULL,  strLink,  NULL, NULL, SW_SHOWNORMAL );
+		}
+	}
+	else
+	{
+		// To use notification in parent window
+		// Respond to a OnNotify in parent and disassemble the message
+		//
+		NMHDR nm;
+
+		nm.hwndFrom = GetSafeHwnd();
+		nm.idFrom  = GetDlgCtrlID();
+		nm.code = NM_LINKCLICK;
+		GetParent()->SendMessage(WM_NOTIFY,nm.idFrom,(LPARAM) &nm);
+	}
+
+	CStatic::OnLButtonDown(nFlags, point);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// THE FUNCTIONS START HERE :----
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetText
+//
+// Description:		Short cut to set window text - caption - label
+//
+// INPUTS:          Text to use
+// 
+// RETURNS:         Reference to this
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26081998    1.0     Origin
+// NT ALMOND				02072002    1.6     Crash Fix
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetText(const CString& strText)
+{
+	if(IsWindow(this->GetSafeHwnd())) 
+	{
+		//SetWindowText(strText);
+		m_strText = strText;
+		UpdateSurface();
+	}
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetTextColor
+//
+// Description:		Sets the text color 
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetTextColor(COLORREF crText)
+{
+
+	m_crText = crText;
+
+	UpdateSurface();
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFontBold
+//
+// Description:		Sets the font ot bold 
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFontBold(BOOL bBold)
+{	
+
+	m_lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL;
+	ReconstructFont();
+	UpdateSurface();
+	return *this;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFontUnderline
+//
+// Description:		Sets font underline attribue
+//
+// INPUTS:          True of false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFontUnderline(BOOL bSet)
+{	
+	m_lf.lfUnderline = bSet;
+	ReconstructFont();
+	UpdateSurface();
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFontItalic
+//
+// Description:		Sets font italic attribute
+//
+// INPUTS:          True of false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFontItalic(BOOL bSet)
+{
+
+	m_lf.lfItalic = bSet;
+	ReconstructFont();
+	UpdateSurface();
+
+	return *this;	
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetSunken
+//
+// Description:		Sets sunken effect on border
+//
+// INPUTS:          True of false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetSunken(BOOL bSet)
+{
+
+	if (!bSet)
+		ModifyStyleEx(WS_EX_STATICEDGE,0,SWP_DRAWFRAME);
+	else
+		ModifyStyleEx(0,WS_EX_STATICEDGE,SWP_DRAWFRAME);
+
+	return *this;	
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetBorder
+//
+// Description:		Toggles the border on/off
+//
+// INPUTS:          True of false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetBorder(BOOL bSet)
+{
+
+	if (!bSet)
+		ModifyStyle(WS_BORDER,0,SWP_DRAWFRAME);
+	else
+		ModifyStyle(0,WS_BORDER,SWP_DRAWFRAME);
+
+	return *this;	
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFontSize
+//
+// Description:		Sets the font size
+//
+// INPUTS:          True of false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFontSize(int nSize)
+{
+
+	CFont cf;
+	LOGFONT lf;
+
+	cf.CreatePointFont(nSize * 10, m_lf.lfFaceName);
+	cf.GetLogFont(&lf);
+
+	m_lf.lfHeight = lf.lfHeight;
+	m_lf.lfWidth  = lf.lfWidth;
+
+	//	nSize*=-1;
+	//	m_lf.lfHeight = nSize;
+	ReconstructFont();
+	UpdateSurface();
+
+	return *this;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetBkColor
+//
+// Description:		Sets background color
+//
+// INPUTS:          Colorref of background color
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetBkColor(COLORREF crBkgnd, COLORREF crBkgndHigh , BackFillMode mode)
+{
+
+	m_crLoColor = crBkgnd;
+	m_crHiColor = crBkgndHigh;
+
+	m_fillmode = mode;
+
+	if (m_hBackBrush)
+		::DeleteObject(m_hBackBrush);
+
+
+	if (m_fillmode == Normal)
+		m_hBackBrush = ::CreateSolidBrush(crBkgnd);
+
+	UpdateSurface();
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFontName
+//
+// Description:		Sets the fonts face name
+//
+// INPUTS:          String containing font name
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+// NT ALMOND				15092000	1.5		Support internation windows
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFontName(const CString& strFont, BYTE byCharSet /* Default = ANSI_CHARSET */)
+{	
+
+	m_lf.lfCharSet = byCharSet;
+
+	_tcscpy_s(m_lf.lfFaceName,strFont);
+	ReconstructFont();
+	UpdateSurface();
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::FlashText
+//
+// Description:		As the function states
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::FlashText(BOOL bActivate)
+{
+
+	if (m_bTimer)
+		KillTimer(1);
+
+	if (bActivate)
+	{
+		m_bState = FALSE;
+
+		m_bTimer = TRUE;
+
+		SetTimer(1,500,NULL);
+
+		m_Type = Text;
+	}
+	else
+		m_Type = None; // Fix
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::FlashBackground
+//
+// Description:		As the function states
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::FlashBackground(BOOL bActivate)
+{
+
+	if (m_bTimer)
+		KillTimer(1);
+
+	if (bActivate)
+	{
+		m_bState = FALSE;
+
+		m_bTimer = TRUE;
+		SetTimer(1,500,NULL);
+
+		m_Type = Background;
+	}
+
+	return *this;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetLink
+//
+// Description:		Indicates the string is a link
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+// NT ALMOND				26/08/99	1.2		Added flexbility of
+//												Sending Click meessage to parent
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetLink(BOOL bLink,BOOL bNotifyParent)
+{
+
+	if (bLink)
+		m_Link = HyperLink;
+	else
+		m_Link = LinkNone;
+
+	m_bNotifyParent = bNotifyParent;
+
+	if (m_Link != LinkNone)
+		ModifyStyle(0,SS_NOTIFY);
+	else
+		ModifyStyle(SS_NOTIFY,0);
+
+
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetLinkCursor
+//
+// Description:		Sets the internet browers link
+//
+// INPUTS:          Handle of cursor
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				26/08/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetLinkCursor(HCURSOR hCursor)
+{
+
+	m_hCursor = hCursor;
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetTransparent
+//
+// Description:		Sets the Label window to be transpaent
+//
+// INPUTS:          True or false
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetTransparent(BOOL bSet)
+{
+
+	m_bTransparent = bSet;
+	ModifyStyleEx(0,WS_EX_TRANSPARENT); // Fix for transparency
+	UpdateSurface();
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFont3D
+//
+// Description:		Sets the 3D attribute of the font.
+//
+// INPUTS:          True or false, Raised or Sunken
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFont3D(BOOL bSet,Type3D type)
+{
+
+	m_bFont3d = bSet;
+	m_3dType = type;
+	UpdateSurface();
+
+
+	return *this;
+}
+
+void CLabel::OnSysColorChange() 
+{
+
+	if (m_hwndBrush)
+		::DeleteObject(m_hwndBrush);
+
+	m_hwndBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+
+	UpdateSurface();
+
+
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetRotationAngle
+//
+// Description:		Sets the rotation angle for the current font.
+//
+// INPUTS:          Angle in Degress
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				22/10/98    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetRotationAngle(UINT nAngle,BOOL bRotation)
+{
+	// Arrrrh...
+	// Your looking in here why the font is rotating, aren't you?
+	// Well try setting the font name to 'Arial' or 'Times New Roman'
+	// Make the Angle 180 and set bRotation to true.
+	//
+	// Font rotation _ONLY_ works with TrueType fonts...
+	//
+	// 
+	m_lf.lfEscapement = m_lf.lfOrientation = (nAngle * 10);
+	m_bRotation = bRotation;
+
+	ReconstructFont();
+
+	UpdateSurface();
+
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetText3DHiliteColor
+//
+// Description:		Sets the 3D font hilite color
+//
+// INPUTS:          Color 
+// 
+// RETURNS:         Reference to 'this' object
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				17/07/00    1.0     Origin
+//
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetText3DHiliteColor(COLORREF cr3DHiliteColor)
+{
+	m_cr3DHiliteColor = cr3DHiliteColor;
+	UpdateSurface();
+
+
+	return *this;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::PreSubclassWindow
+//
+// Description:		Assigns default dialog font
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				15092000    1.5     Origin
+// NT ALMOND				02072002    1.6     Fix crash when GetFont returns NULL
+//////////////////////////////////////////////////////////////////////////
+void CLabel::PreSubclassWindow() 
+{
+
+	CStatic::PreSubclassWindow();
+
+	CFont* cf = GetFont();
+	if(cf !=NULL)
+	{
+		cf->GetObject(sizeof(m_lf),&m_lf);
+	}
+	else
+	{
+		GetObject(GetStockObject(SYSTEM_FONT),sizeof(m_lf),&m_lf);
+	}
+
+	ReconstructFont();
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::PreCreateWindow
+//
+// Description:		
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				15092000    1.5     Origin
+//////////////////////////////////////////////////////////////////////////
+BOOL CLabel::PreCreateWindow(CREATESTRUCT& cs) 
+{	
+	return CStatic::PreCreateWindow(cs);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::DrawGradientFill
+//
+// Description:		Internal help function to gradient fill background
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				15092000    1.5     Origin
+//////////////////////////////////////////////////////////////////////////
+void CLabel::DrawGradientFill(CDC* pDC, CRect* pRect, COLORREF crStart, COLORREF crEnd, int nSegments)
+{
+	// Get the starting RGB values and calculate the incremental
+	// changes to be applied.
+
+	COLORREF cr;
+	int nR = GetRValue(crStart);
+	int nG = GetGValue(crStart);
+	int nB = GetBValue(crStart);
+
+	int neB = GetBValue(crEnd);
+	int neG = GetGValue(crEnd);
+	int neR = GetRValue(crEnd);
+
+	if(nSegments > pRect->Width())
+		nSegments = pRect->Width();
+
+	int nDiffR = (neR - nR);
+	int nDiffG = (neG - nG);
+	int nDiffB = (neB - nB);
+
+	int ndR = 256 * (nDiffR) / (max(nSegments,1));
+	int ndG = 256 * (nDiffG) / (max(nSegments,1));
+	int ndB = 256 * (nDiffB) / (max(nSegments,1));
+
+	nR *= 256;
+	nG *= 256;
+	nB *= 256;
+
+	neR *= 256;
+	neG *= 256;
+	neB *= 256;
+
+	int nCX = pRect->Width() / max(nSegments,1), nLeft = pRect->left, nRight;
+	pDC->SelectStockObject(NULL_PEN);
+
+	for (int i = 0; i < nSegments; i++, nR += ndR, nG += ndG, nB += ndB)
+	{
+		// Use special code for the last segment to avoid any problems
+		// with integer division.
+
+		if (i == (nSegments - 1))
+			nRight = pRect->right;
+		else
+			nRight = nLeft + nCX;
+
+		cr = RGB(nR / 256, nG / 256, nB / 256);
+
+		{
+			CBrush br(cr);
+			CBrush* pbrOld = pDC->SelectObject(&br);
+			pDC->Rectangle(nLeft, pRect->top, nRight + 1, pRect->bottom);
+			pDC->SelectObject(pbrOld);
+		}
+
+		// Reset the left side of the drawing rectangle.
+
+		nLeft = nRight;
+	}
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetFont
+//
+// Description:		Sets font with LOGFONT structure
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				02072002    1.6     Origin
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetFont(LOGFONT lf)
+{
+	CopyMemory(&m_lf, &lf, sizeof(m_lf));
+	ReconstructFont();
+	UpdateSurface();
+	return *this;
+
+}
+
+BOOL CLabel::OnEraseBkgnd(CDC* pDC) 
+{
+	// TODO: Add your message handler code here and/or call default
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetMailLink
+//
+// Description:		Sets the label so it becomes Mail enabled
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				02072002    1.6     Origin
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetMailLink(BOOL bEnable, BOOL bNotifyParent)
+{
+	if (bEnable)
+		m_Link = MailLink;
+	else
+		m_Link = LinkNone;
+
+
+	m_bNotifyParent = bNotifyParent;
+
+	if (m_Link != LinkNone)
+		ModifyStyle(0,SS_NOTIFY);
+	else
+		ModifyStyle(SS_NOTIFY,0);
+
+	return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Function:		CLabel::SetHyperLink
+//
+// Description:		Sets the label so it becomes hyperlink enabled
+//
+// INPUTS:          
+// 
+// RETURNS:         
+//
+// NOTES:			
+// 
+// MODIFICATIONS:
+//
+// Name                     Date        Version Comments
+// NT ALMOND				02072002    1.6     Origin
+//////////////////////////////////////////////////////////////////////////
+CLabel& CLabel::SetHyperLink(const CString& sLink)
+{
+	m_sLink = sLink;
+
+	return *this;
+}
+
+/*************************************************************
+*add at  : 2014-08-11  by唐太闲
+*describe: 设置背景透明,返回空画刷                  
+*************************************************************/
+HBRUSH CLabel::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
+{
+	// TODO:  在此更改 DC 的任何属性
+
+	// TODO:  如果不应调用父级的处理程序,则返回非 null 画笔
+	//return NULL;
+	pDC->SetBkMode(TRANSPARENT);  
+	return (HBRUSH)GetStockObject(NULL_BRUSH);
+}

+ 117 - 0
Source/OGCAssistTool/OGCAssistTool/SubLabel.h

@@ -0,0 +1,117 @@
+#if !defined(AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
+#define AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// Label.h : header file
+//
+
+#define	NM_LINKCLICK	WM_APP + 0x200
+
+/////////////////////////////////////////////////////////////////////////////
+// CLabel window
+
+class CLabel : public CStatic
+{
+	// Construction
+public:
+
+
+	enum LinkStyle { LinkNone, HyperLink, MailLink };
+	enum FlashType {None, Text, Background };
+	enum Type3D { Raised, Sunken};
+	enum BackFillMode { Normal, Gradient };
+
+	CLabel();
+	virtual CLabel& SetBkColor(COLORREF crBkgnd, COLORREF crBkgndHigh = 0, BackFillMode mode = Normal);
+	virtual CLabel& SetTextColor(COLORREF crText);
+	virtual CLabel& SetText(const CString& strText);
+	virtual CLabel& SetFontBold(BOOL bBold = TRUE);
+	virtual CLabel& SetFontName(const CString& strFont, BYTE byCharSet = ANSI_CHARSET);
+	virtual CLabel& SetFontUnderline(BOOL bSet = TRUE);
+	virtual CLabel& SetFontItalic(BOOL bSet = TRUE);
+	virtual CLabel& SetFontSize(int nSize);
+	virtual CLabel& SetSunken(BOOL bSet );
+	virtual CLabel& SetBorder(BOOL bSet = TRUE);
+	virtual CLabel& SetTransparent(BOOL bSet);
+	virtual CLabel& FlashText(BOOL bActivate);
+	virtual CLabel& FlashBackground(BOOL bActivate);
+	virtual CLabel& SetLink(BOOL bLink,BOOL bNotifyParent);
+	virtual CLabel& SetLinkCursor(HCURSOR hCursor);
+	virtual CLabel& SetFont3D(BOOL bSet,Type3D type=Raised);
+	virtual CLabel& SetRotationAngle(UINT nAngle,BOOL bRotation);
+	virtual CLabel& SetText3DHiliteColor(COLORREF cr3DHiliteColor);
+	virtual CLabel& SetFont(LOGFONT lf);
+	virtual CLabel& SetMailLink(BOOL bEnable, BOOL bNotifyParent);
+	virtual CLabel& SetHyperLink(const CString& sLink);
+
+	// Attributes
+public:
+protected:
+	void UpdateSurface();
+	void ReconstructFont();
+	void DrawGradientFill(CDC* pDC, CRect* pRect, COLORREF crStart, COLORREF crEnd, int nSegments);
+	COLORREF		m_crText;
+	COLORREF		m_cr3DHiliteColor;
+	HBRUSH			m_hwndBrush;
+	HBRUSH			m_hBackBrush;
+	LOGFONT			m_lf;
+	CFont			m_font;
+	BOOL			m_bState;
+	BOOL			m_bTimer;
+	LinkStyle		m_Link;
+	BOOL			m_bTransparent;
+	BOOL			m_bFont3d;
+	BOOL			m_bToolTips;
+	BOOL			m_bNotifyParent;
+	BOOL			m_bRotation;
+	FlashType		m_Type;
+	HCURSOR			m_hCursor;
+	Type3D			m_3dType;
+	BackFillMode	m_fillmode;
+	COLORREF		m_crHiColor;
+	COLORREF		m_crLoColor;
+	CString			m_sLink;
+	CString			m_strText;
+	CDC* m_pMemDC;
+	//CDC* pDCMem;
+
+	// Operations
+public:
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CLabel)
+protected:
+	virtual void PreSubclassWindow();
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	virtual ~CLabel();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CLabel)
+	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+	afx_msg void OnSysColorChange();
+	afx_msg void OnPaint();
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+public:
+	//tc:这就是新添加的ON_WM_CTLCOLOR_REFLECT()消息的响应函数
+	afx_msg HBRUSH CtlColor(CDC* /*pDC*/, UINT /*nCtlColor*/);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)

+ 260 - 0
Source/OGCAssistTool/OGCAssistTool/XColorStatic.cpp

@@ -0,0 +1,260 @@
+#include "stdafx.h"
+#include "XColorStatic.h"
+#include "FontSize.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/***************************************************************************************/
+// CXColorStatic
+BEGIN_MESSAGE_MAP(CXColorStatic, CStatic)
+    // {{ AFX_MSG_MAP
+    ON_WM_PAINT()
+    ON_WM_ERASEBKGND()
+    // }} AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/***************************************************************************************/
+// CXColorStatic
+CXColorStatic::CXColorStatic()
+{
+    m_rgbText           = GetSysColor(COLOR_BTNTEXT);
+    m_rgbBackground     = GetSysColor(COLOR_BTNFACE);
+    m_pBrush            = new CBrush(m_rgbBackground);
+    m_bBold             = FALSE;
+    m_hIcon             = NULL;
+    m_iXMargin          = 0;
+    m_iYMargin          = 0;
+}
+
+/***************************************************************************************/
+// ~CXColorStatic
+CXColorStatic::~CXColorStatic()
+{
+    TRACE(_T("in CXColorStatic::!CXColorStatic\n"));
+
+    if(m_font.GetSafeHandle())
+        m_font.DeleteObject();
+
+    if(m_pBrush)
+    {
+        m_pBrush->DeleteObject();
+        delete m_pBrush;
+    }
+    m_pBrush = NULL;
+}
+
+/***************************************************************************************/
+// PreSubclassWindow
+void CXColorStatic::PreSubclassWindow()
+{
+    TRACE(_T("in CXColorStatic::PreSubclassWindow\n"));
+
+    // 获取字体
+    CFont* pFont = GetFont();
+    if(!pFont)
+    {
+        HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+        if(hFont == NULL)
+            hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
+        if(hFont)
+            pFont = CFont::FromHandle(hFont);
+    }
+    ASSERT(pFont);
+    ASSERT(pFont->GetSafeHandle());
+
+    // 为这个控件创建一个字体
+    LOGFONT lf;
+    pFont->GetLogFont(&lf);
+    m_font.CreateFontIndirect(&lf);
+}
+
+/***************************************************************************************/
+// OnPaint
+void CXColorStatic::OnPaint()
+{
+    CPaintDC dc(this);  // 获取到绘制对象的设备上下文
+
+    dc.SaveDC();
+
+    dc.SetTextColor(m_rgbText);
+    dc.SetBkColor(m_rgbBackground);
+    dc.SetBkMode(OPAQUE);
+    dc.SelectObject(m_pBrush);
+
+    CRect rect;
+    GetClientRect(rect);
+
+    // 不能同时绘制图标和文本
+    if(m_hIcon)
+    {
+        int iIconX = GetSystemMetrics(SM_CXICON);
+        int iIconY = GetSystemMetrics(SM_CYICON);
+
+        rect.left = rect.left + (rect.Width() - iIconX) / 2;
+        rect.top = rect.top + (rect.Height() - iIconY) / 2;
+		 
+        dc.DrawIcon(rect.left, rect.top, m_hIcon);
+    }
+    else
+    {
+        dc.SelectObject(&m_font);
+
+        // 获取静态文本
+        CString strText = _T("");
+        GetWindowText(strText);
+
+        UINT uiFormat = 0;
+        DWORD dwStyle = GetStyle();
+
+        // 重新绘制静态文本
+        if(dwStyle && SS_CENTER)
+            uiFormat |= DT_CENTER;
+        else if(dwStyle && SS_LEFT)
+            uiFormat |= DT_LEFT;
+        else if(dwStyle && SS_RIGHT)
+            uiFormat |= DT_RIGHT;
+
+        if(dwStyle & SS_CENTERIMAGE)    // 垂直居中 ==> 仅对单行
+            uiFormat |= DT_VCENTER | DT_SINGLELINE;
+        else
+            uiFormat |= DT_WORDBREAK;
+		 
+		uiFormat  = DT_LEFT;
+	
+
+        rect.left += m_iXMargin;
+
+        rect.top += m_iYMargin;
+
+        dc.DrawText(strText, rect, uiFormat);
+    }
+
+    dc.RestoreDC(-1);
+}
+
+/***************************************************************************************/
+// OnEraseBkgnd
+BOOL CXColorStatic::OnEraseBkgnd(CDC *pDC)
+{
+    CRect cr;
+    GetClientRect(cr);
+    pDC->FillRect(&cr, m_pBrush);
+
+    return TRUE;
+}
+
+/***************************************************************************************/
+// SetFont
+void CXColorStatic::SetFont(LOGFONT *pLogFont, BOOL bRedraw /* = TRUE */)
+{
+    ASSERT(pLogFont);
+    if(!pLogFont)
+        return;
+
+    if(m_font.GetSafeHandle())
+        m_font.DeleteObject();
+
+    LOGFONT lf = *pLogFont;
+    lf.lfWeight = m_bBold ? FW_BOLD : FW_NORMAL;
+
+    m_font.CreateFontIndirect(&lf);
+
+    if(bRedraw)
+        RedrawWindow();
+}
+
+/***************************************************************************************/
+// SetFont
+void CXColorStatic::SetFont(LPCTSTR lpszFaceName, int iPointSize, BOOL bRedraw /* = TRUE */)
+{
+    // 如果指定的字体名字不存在或未指定, 将使用默认的字体
+    LOGFONT lf;
+    memset(&lf, 0, sizeof(lf));
+
+    if(lpszFaceName == NULL)
+    {
+        CFont* pFont = GetFont();
+        ASSERT(pFont);
+        pFont->GetLogFont(&lf);
+    }
+    else
+    {
+        _tcsncpy_s(lf.lfFaceName, lpszFaceName, sizeof(lf.lfFaceName) / sizeof(TCHAR) - 1);
+    }
+
+    lf.lfHeight = GetFontHeight(iPointSize);
+    SetFont(&lf, bRedraw);
+}
+
+/***************************************************************************************/
+// SetFont
+void CXColorStatic::SetFont(CFont *pFont, BOOL bRedraw /* = TRUE */)
+{
+    ASSERT(pFont);
+    if(!pFont)
+        return;
+
+    LOGFONT lf;
+    memset(&lf, 0, sizeof(lf));
+
+    pFont->GetLogFont(&lf);
+
+    SetFont(&lf, bRedraw);
+}
+
+/***************************************************************************************/
+// SetTextColor
+void CXColorStatic::SetTextColor(COLORREF rgb, BOOL bRedraw /* = TRUE */)
+{
+    m_rgbText = rgb;
+    if(bRedraw)
+        RedrawWindow();
+}
+
+/***************************************************************************************/
+// SetBold
+void CXColorStatic::SetBold(BOOL bFlag, BOOL bRedraw /* = TRUE */)
+{
+    m_bBold = bFlag;
+
+    LOGFONT lf;
+    memset(&lf, 0, sizeof(lf));
+
+    CFont* pFont = GetFont();
+    ASSERT(pFont);
+    pFont->GetLogFont(&lf);
+
+    lf.lfWeight = m_bBold ? FW_BOLD : FW_NORMAL;
+	
+	SetFont(&lf, bRedraw);
+}
+
+/***************************************************************************************/
+// SetBackgroundColor
+void CXColorStatic::SetBackgroundColor(COLORREF rgb, BOOL bRedraw /* = TRUE */)
+{
+	m_rgbBackground = rgb;
+	if(m_pBrush)
+	{
+		m_pBrush->DeleteObject();
+		delete m_pBrush;
+	}
+	m_pBrush = new CBrush(m_rgbBackground);
+	if(bRedraw)
+		RedrawWindow();
+}
+
+/***************************************************************************************/
+// SetIcon
+void CXColorStatic::SetIcon(HICON hIcon, BOOL bRedraw /* = TRUE */)
+{
+	ASSERT(hIcon);
+	
+	m_hIcon = hIcon;
+	if(bRedraw)
+		RedrawWindow();
+}

+ 47 - 0
Source/OGCAssistTool/OGCAssistTool/XColorStatic.h

@@ -0,0 +1,47 @@
+#ifndef __X_COLOR_STATIC_H__
+#define __X_COLOR_STATIC_H__
+
+class CXColorStatic : public CStatic
+{
+// 构造函数和析构函数声明
+public:
+    CXColorStatic();
+    virtual ~CXColorStatic();
+
+//成员函数声明
+public:
+    void SetBackgroundColor(COLORREF rgb, BOOL bRedraw = TRUE);
+    void SetTextColor(COLORREF rgb, BOOL bRedraw = TRUE);
+    void SetBold(BOOL bFlag, BOOL bRedraw = TRUE);
+    void SetFont(LPCTSTR lpszFaceName, int iPointSize, BOOL bRedraw = TRUE);
+    void SetFont(LOGFONT* pLogFont, BOOL bRedraw = TRUE);
+    void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
+    void SetIcon(HICON hIcon, BOOL bRedraw = TRUE);
+    void SetMargins(int x, int y) {m_iXMargin = x; m_iYMargin = y;}
+
+// 方法覆盖
+// {{AFX_VIRTUAL
+protected:
+    virtual void PreSubclassWindow();
+// }}AFX_VIRTUAL
+
+// 数据成员
+protected:
+    CFont       m_font;
+    COLORREF    m_rgbText;
+    COLORREF    m_rgbBackground;
+    CBrush*     m_pBrush;
+    BOOL        m_bBold;
+    int         m_iXMargin, m_iYMargin;
+    HICON       m_hIcon;
+
+// 消息映射方法
+protected:
+    // {{AFX_MSG
+    afx_msg void OnPaint();
+    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+    // }}AFX_MSG
+    DECLARE_MESSAGE_MAP();
+};
+
+#endif

+ 3 - 2
Source/OGCAssistTool/OGCAssistTool/resource.h

@@ -40,14 +40,15 @@
 #define BTN_TEST                        1015
 #define BTN_CONNECT                     1016
 #define BTN_LOAD_DATA                   1017
+#define LABLE_RESULT                    1018
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        133
+#define _APS_NEXT_RESOURCE_VALUE        134
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         1018
+#define _APS_NEXT_CONTROL_VALUE         1019
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif