SystemFont.cpp
上传用户:zhoushen
上传日期:2022-06-15
资源大小:84k
文件大小:1k
- #include "StdAfx.h"
- #include "SystemFont.h"
- CSystemFont::~CSystemFont()
- {
- if (m_Font.m_hObject)
- m_Font.DeleteObject();
- }
- CFont* CSystemFont::operator()()
- {
- if (!m_Font.m_hObject)
- CreateSystemFont();
- return &m_Font;
- }
- void CSystemFont::CreateSystemFont()
- {
- NONCLIENTMETRICS ncm;
- memset(&ncm, 0, sizeof(ncm));
- ncm.cbSize = sizeof(ncm);
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
- if (m_Font.m_hObject)
- m_Font.DeleteObject();
-
- m_Font.CreateFontIndirect(&ncm.lfCaptionFont);
- }