扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:刘涛 来源:天极开发 2007年10月16日
关键字:
//////// MainFrm.cpp : implementation of the CMainFrame class #include "stdafx.h" #include "FindSysIcon.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code ! ON_WM_CREATE() ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; const struct { LPCTSTR nResID; LPCTSTR name; } SysIcons[] = { { IDI_APPLICATION, _T("IDI_APPLICATION") }, { IDI_HAND, _T("IDI_HAND") }, { IDI_QUESTION, _T("IDI_QUESTION") }, { IDI_EXCLAMATION, _T("IDI_EXCLAMATION") }, { IDI_ASTERISK, _T("IDI_ASTERISK") }, #if(WINVER >= 0x0400) { IDI_WINLOGO, _T("IDI_WINLOGO") }, { IDI_WARNING, _T("IDI_WARNING") }, { IDI_ERROR, _T("IDI_ERROR") }, { IDI_INFORMATION, _T("IDI_INFORMATION") }, #endif { NULL, NULL } }; CMainFrame::CMainFrame() { // TODO: add member initialization code here } CMainFrame::~CMainFrame() {} int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { return CFrameWnd::OnCreate(lpCreateStruct); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { BOOL bRet = CFrameWnd::PreCreateWindow(cs); cs.cx=200; cs.cy=400; return bRet; } #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG void CMainFrame::OnPaint() { CPaintDC dc(this); CRect rcClient; GetClientRect(&rcClient); int cyIcon = GetSystemMetrics(SM_CYICON); int cxIcon = GetSystemMetrics(SM_CXICON); CRect rcIcon(0,0,cxIcon,cyIcon); CRect rcText(cxIcon, 0, rcClient.Width()-cxIcon, cyIcon); for (UINT i=0; SysIcons[i].nResID; i++) { HICON hicon = ::LoadIcon(NULL, SysIcons[i].nResID); ASSERT(hicon); CString name = SysIcons[i].name; dc.DrawIcon(rcIcon.TopLeft(), hicon); dc.DrawText(name, rcText, DT_LEFT); rcIcon += CPoint(0, rcIcon.Height()); rcText += CPoint(0, rcIcon.Height()); } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者