当前位置: 首页 > 图文教程 > 开发语言 > VC++ > 在VC++.net中制作启动屏幕的新方法
在VC++.net中制作启动屏幕的新方法 下载本文示例工程 BOOL CSplash::OnInitDialog(){ CDialog::OnInitDialog(); //设置启动窗口背景,在整个窗口中充满位图 CRect lRect; m_pic.GetClientRect(&lRect);//得到Picture控件的窗口大小 lRect.NormalizeRect(); //设置位图句柄 HBITMAP hbitmap=(HBITMAP)LoadImage(NULL,"splash.bmp",//更改你喜欢的位图文件 IMAGE_BITMAP,lRect.Width(),lRect.Height(), LR_LOADFROMFILE|LR_CREATEDIBSECTION); m_pic.SetBitmap(hbitmap); //设置定时器 SetTimer(1,500,NULL); return TRUE; }7. 在OnTimer(UINT nIDEvent) 函数中添加代码如下:void CSplash::OnTimer(UINT nIDEvent){ static int i; i++; if(i > 3) { //销毁定时器 KillTimer(1); this->OnOK(); } CDialog::OnTimer(nIDEvent);}8. 在OnLButtonUp,OnLButtonUp,OnLButtonUp,OnChar函数中加入以下代码:{ KillTimer(1); this->OnOK();}9. 在MySample.Cpp中引入头文件#include "Splash.h"在InitInstance()函数中加入代码: BOOL CMySampleApp::InitInstance(){ … AfxEnableControlContainer(); CSplash splash; splash.DoModal();…} 至此,启动屏幕就Ok了!作者:陈治军 联系地址:成都市新都区西南石油学院硕2001.3班 邮政编码:610500 Email:[email protected] |
评论 (0) All