---- 9.在CsplashWnd类的OnTimer中加入以下内容,不断变换文字垂向位置,使具有滚动效果:
void CSplashWnd::OnTimer(UINT nIDEvent) { m_nCurPos++; if( m_nCurPos>300 ) { m_nCurPos = 0 ; } Invalidate(TRUE); }
10. 演示软件封面时,隐藏主框架窗口: BOOL CTestApp::InitInstance() { ...... m_pMainWnd->ShowWindow(SW_HIDE); m_pMainWnd->UpdateWindow(); ....... } ---- 11. 在CsplashWnd类中重载WindowProc函数,按任意键或点击鼠标键结束封面演示:
LRESULT CSplashWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (c_pSplashWnd) { if (message == WM_KEYDOWN ||message == WM_SYSKEYDOWN || message == WM_LBUTTONDOWN ||message == WM_RBUTTONDOWN || message == WM_MBUTTONDOWN ||message == WM_NCLBUTTONDOWN || message == WM_NCRBUTTONDOWN ||message == WM_NCMBUTTONDOWN) { c_pSplashWnd->HideSplashScreen(); AfxGetMainWnd()->ShowWindow(SW_MAXIMIZE); return TRUE; }
} return CWnd::WindowProc(message, wParam, lParam); }
---- 12.重载虚拟函数PostNcDestroy,在封面窗口销毁后释放有关对象:
void CSplashWnd::PostNcDestroy() {... // Free the C++ class. m_dcImage.SelectObject(m_pOldBitmap); m_dcText.SelectClipRgn(NULL); m_dcText.SelectObject(m_pOldBitmapText); m_bitmap.DeleteObject(); m_rgn.DeleteObject(); delete this; ...... } ---- 文中程序在Windows98/Visual C++6.0下运行通过。 
说明:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,wanshiok.com不保证资料的完整性。
2/2 首页 上一页 1 2 |