📄 titlewnd.cpp
字号:
/************************************************************************************************
// $Header: /home/cvsroot/SoccerDoctor/Chart/TitleWnd.cpp,v 1.4 2002/09/10 06:44:35 peter Exp $
//***********************************************************************************************
/************************************************************************************************/
/* */
/* File : TitleWnd.cpp */
/* */
/* Purpose : interface for the footer and header windows of the CChartCtrl */
/* */
/* Author : Scott Pelger Date Created: 10JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 10JUN02 initial version */
/* */
/************************************************************************************************/
#include "stdafx.h"
#include "TitleWnd.h"
/////////////////////////////////////////////////////////////////////////////
// CTitleWnd
CTitleWnd::CTitleWnd() :
m_dwChartWndExtentLo(0),
m_dwChartWndExtentHi(0),
//m_wRightEdge(0),
m_dwStyle(NONE) {}
CTitleWnd::~CTitleWnd() {}
BEGIN_MESSAGE_MAP(CTitleWnd, CChartWndBase)
//{{AFX_MSG_MAP(CTitleWnd)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTitleWnd message handlers
/************************************************************************************************/
/* */
/* Function: CTitleWnd::CalculateWndHeight() */
/* */
/* Purpose : calculates the height of the window based on the specified font. */
/* */
/* Inputs : CDC* pDC -> dc to calculate with */
/* DWORD* dwHeight -> height of window */
/* */
/* Outputs : BOOL <- FALSE of success */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 11JUN02 initial version */
/* */
/************************************************************************************************/
BOOL CTitleWnd::CalculateWndHeight(CDC* pDC, DWORD* dwHeight) {
if (!m_pFont)
ASSERT(FALSE);
CFont* pOldFont = pDC->GetCurrentFont();
CRect Rect(0, 0, 0, 0);
pDC->SelectObject(m_pFont);
pDC->DrawText("X", 1, &Rect, DT_CALCRECT);
*dwHeight = Rect.Height();
*dwHeight += T_MARGIN + B_MARGIN;
pDC->SelectObject(pOldFont);
return FALSE;
}
void CTitleWnd::OnPaint() {
CPaintDC dc(this);
GetClientRect(&m_rcClientRect);
dc.FillSolidRect(&m_rcClientRect, m_crWindowColor);
CFont* pFont = dc.GetCurrentFont();
dc.SelectObject(m_pFont);
COLORREF OldColor = dc.SetTextColor(m_crTextColor);
CRect Rect(0, 0, 0, 0);
if (m_sLText!="") {
dc.DrawText(m_sLText, &Rect, DT_CALCRECT);
int nYOffset = ((m_rcClientRect.Height() - (T_MARGIN + B_MARGIN)) - Rect.Height())/2;
Rect.OffsetRect(L_MARGIN, T_MARGIN + nYOffset);
dc.DrawText(m_sLText, Rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
Rect.SetRectEmpty();
}
if (m_sMText!="") {
dc.DrawText(m_sMText, &Rect, DT_CALCRECT);
int nYOffset = ((m_rcClientRect.Height() - (T_MARGIN + B_MARGIN)) - Rect.Height())/2;
Rect.OffsetRect((m_rcClientRect.Width()-Rect.Width())/2, T_MARGIN + nYOffset);
dc.DrawText(m_sMText, Rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
Rect.SetRectEmpty();
}
if (m_sRText!="") {
dc.DrawText(m_sRText, &Rect, DT_CALCRECT);
int nYOffset = ((m_rcClientRect.Height() - (T_MARGIN + B_MARGIN)) - Rect.Height())/2;
Rect.OffsetRect(m_rcClientRect.Width()-R_MARGIN-Rect.Width(), T_MARGIN + nYOffset);
dc.DrawText(m_sRText, Rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
Rect.SetRectEmpty();
}
dc.SelectObject(pFont);
dc.SetTextColor(OldColor);
}
//***********************************************************************************************
// END OF FILE
// $Log: TitleWnd.cpp,v $
// Revision 1.4 2002/09/10 06:44:35 peter
// 没有GDI资源泄漏了
//
// Revision 1.3 2002/09/09 05:10:11 peter
// 修改全是0之后会死的bug,GDI资源漏洞依然存在
//
// 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 + -