📄 chartwndbase.cpp
字号:
/************************************************************************************************
// $Header: /home/cvsroot/SoccerDoctor/Chart/ChartWndBase.cpp,v 1.4 2002/09/09 05:10:11 peter Exp $
//***********************************************************************************************
/************************************************************************************************/
/* */
/* File : ChartWndBase.cpp */
/* */
/* Purpose : base class for the four main windows contained within the CChartCtrl */
/* */
/* Author : Scott Pelger Date Created: 10JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 10JUN02 initial version */
/* */
/************************************************************************************************/
// ChartWndBase.cpp : implementation file
//
#include "stdafx.h"
#include "ChartWndBase.h"
/////////////////////////////////////////////////////////////////////////////
// CChartWndBase
CChartWndBase::CChartWndBase() :
m_pFont(NULL),
m_crTextColor(RGB(0, 0, 0)),
m_crWindowColor(RGB(0, 0, 0)),
m_rcClientRect(0, 0, 0, 0) {}
CChartWndBase::~CChartWndBase() {
if (m_pFont){
m_pFont->DeleteObject();
delete m_pFont;
}
return;
}
BEGIN_MESSAGE_MAP(CChartWndBase, CWnd)
//{{AFX_MSG_MAP(CChartWndBase)
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChartWndBase message handlers
/************************************************************************************************/
/* */
/* Function: CChartWndBase::SetFont() */
/* */
/* Purpose : sets the font for this window */
/* */
/* Inputs : BYTE byPointSize -> size of the font */
/* char* psFontName -> name of the font */
/* BYTE byStyle -> styles to be applied to the font */
/* */
/* Outputs : BOOL <- FALSE if sucessful, TRUE otherwise */
/* */
/* Author : Scott Pelger Date Created: 15MAY02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 15MAY02 initial version */
/* */
/************************************************************************************************/
BOOL CChartWndBase::SetFont(BYTE byPointSize, char* psFontName, BYTE byStyle/*=0*/) {
if (m_pFont){
m_pFont->DeleteObject();
}
if (!m_pFont) {
m_pFont = new CFont;
if (!m_pFont){
return TRUE;
}
}
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
strcpy(lf.lfFaceName, psFontName);
lf.lfHeight = byPointSize*10;
lf.lfWeight = byStyle&BOLD?FW_BOLD:FW_NORMAL;
lf.lfItalic = byStyle&ITALIC;
lf.lfUnderline = byStyle&UNDERLINE;
CClientDC dc(this);
m_pFont->CreatePointFontIndirect(&lf, &dc);
return FALSE;
}
void CChartWndBase::OnLButtonDown(UINT nFlags, CPoint point) {
CWnd::OnLButtonDown(nFlags, point);
CWnd* pWnd = GetParent();
if (pWnd) {
//convert the point coordinate to that of the parents
ClientToScreen(&point);
pWnd->ScreenToClient(&point);
LPARAM lParam(point.y<<16);
lParam += point.x;
pWnd->SendMessage(WM_LBUTTONDOWN, (WPARAM)nFlags, lParam);
}
}
void CChartWndBase::OnLButtonDblClk(UINT nFlags, CPoint point) {
CWnd::OnLButtonDblClk(nFlags, point);
CWnd* pWnd = GetParent();
if (pWnd) {
//convert the point coordinate to that of the parents
ClientToScreen(&point);
pWnd->ScreenToClient(&point);
LPARAM lParam(point.y<<16);
lParam += point.x;
pWnd->SendMessage(WM_LBUTTONDBLCLK, (WPARAM)nFlags, lParam);
}
}
void CChartWndBase::OnRButtonDown(UINT nFlags, CPoint point) {
CWnd::OnRButtonDown(nFlags, point);
CWnd* pWnd = GetParent();
if (pWnd) {
//convert the point coordinate to that of the parents
ClientToScreen(&point);
pWnd->ScreenToClient(&point);
LPARAM lParam(point.y<<16);
lParam += point.x;
pWnd->SendMessage(WM_RBUTTONDOWN, (WPARAM)nFlags, lParam);
}
}
//***********************************************************************************************
// END OF FILE
// $Log: ChartWndBase.cpp,v $
// Revision 1.4 2002/09/09 05:10:11 peter
// 修改全是0之后会死的bug,GDI资源漏洞依然存在
//
// Revision 1.3 2002/09/08 04:49:38 peter
// 两个没有用的文件,fix资源漏洞
//
// Revision 1.2 2002/09/08 03:42:36 peter
// 可以在98下面用了,chart 当所有值都是0的时候有问题
//
// Revision 1.1 2002/09/07 06:03:54 peter
// 新的chart类,从别的地方拷来的
//
//***********************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -