如何制作启动界面 C+/VC
2008-09-12 12:39
447 查看
如何制作启动界面 C+/VC
实现闪屏一、安装splash screen组件 点击菜单project/add to project/component and control,然后双击”visual c++ components” , 选中splash screen组件,接受默认id为 idb_splash.(笔者在此处有疑问,接受默认的id时当程序运行时总没有闪屏出现,重新取个id就可以了,试试看!)二、插入位图用一幅准备好的真彩位图替换刚才生成的即可。真彩位图在资源编辑器(它不能打开超过256色的图片)中是不可视的!或者,点击resouce view ,在bitmap上点击鼠标右键,选中“import…”菜单项,然后选你所要的真彩位图资源,把位图的id设置为idb_splash.。 三、运行程序编译、连接,漂亮的真彩启动位图就显示出来了。就这么简单!四、几点说明 1.如果你要改变启动画面的停留时间,就修改settime 中的第二个参数,这里是750毫秒。int csplashwnd::oncreate(lpcreatestruct lpcreatestruct){ if (cwnd::oncreate(lpcreatestruct) == -1) return -1;
// center the window. centerwindow();
// set a timer to destroy the splash screen. settimer(1, 750, null); 此停留时间为0。75秒,可通过修改第二个参数来改变闪屏时间!
return 0;}2.基于对话框的程序不能插入闪屏,可如下设置:首先创建一对话框工程,将刚才已经生成的splash.cpp和splash.h文件拷贝到工作文件夹,并将其加入到你的基于对话框的项目中(project->add to project->files...)。在cdialogapp派生类的initinstance()中加入下列代码:#include "splash.h"bool cdialogapp::initinstance(){ // cg: the following block was added by the splash screen component. { ccommandlineinfo cmdinfo; parsecommandline(cmdinfo); csplashwnd::enablesplashscreen(cmdinfo.m_bshowsplash); } ......}使用class wizard为在cdialog派生类添加oncreate()函数,并加入下列代码:#include "splash.h"int cdialogldlg::oncreate(lpcreatestruct lpcreatestruct){ if (cdialog::oncreate(lpcreatestruct) == -1) return -1; // cg: the following line was added by thesplash screen component. csplashwnd::showsplashscreen(this); return 0;}最后将splash.cpp文件中的csplashwnd::create()函数中的位图资源id改为真彩位图的id就可以了。bool csplashwnd::create(cwnd* pparentwnd /*= null*/){ if (!m_bitmap.loadbitmap(idb_bitmap1)) return false; ......}
实现闪屏一、安装splash screen组件 点击菜单project/add to project/component and control,然后双击”visual c++ components” , 选中splash screen组件,接受默认id为 idb_splash.(笔者在此处有疑问,接受默认的id时当程序运行时总没有闪屏出现,重新取个id就可以了,试试看!)二、插入位图用一幅准备好的真彩位图替换刚才生成的即可。真彩位图在资源编辑器(它不能打开超过256色的图片)中是不可视的!或者,点击resouce view ,在bitmap上点击鼠标右键,选中“import…”菜单项,然后选你所要的真彩位图资源,把位图的id设置为idb_splash.。 三、运行程序编译、连接,漂亮的真彩启动位图就显示出来了。就这么简单!四、几点说明 1.如果你要改变启动画面的停留时间,就修改settime 中的第二个参数,这里是750毫秒。int csplashwnd::oncreate(lpcreatestruct lpcreatestruct){ if (cwnd::oncreate(lpcreatestruct) == -1) return -1;
// center the window. centerwindow();
// set a timer to destroy the splash screen. settimer(1, 750, null); 此停留时间为0。75秒,可通过修改第二个参数来改变闪屏时间!
return 0;}2.基于对话框的程序不能插入闪屏,可如下设置:首先创建一对话框工程,将刚才已经生成的splash.cpp和splash.h文件拷贝到工作文件夹,并将其加入到你的基于对话框的项目中(project->add to project->files...)。在cdialogapp派生类的initinstance()中加入下列代码:#include "splash.h"bool cdialogapp::initinstance(){ // cg: the following block was added by the splash screen component. { ccommandlineinfo cmdinfo; parsecommandline(cmdinfo); csplashwnd::enablesplashscreen(cmdinfo.m_bshowsplash); } ......}使用class wizard为在cdialog派生类添加oncreate()函数,并加入下列代码:#include "splash.h"int cdialogldlg::oncreate(lpcreatestruct lpcreatestruct){ if (cdialog::oncreate(lpcreatestruct) == -1) return -1; // cg: the following line was added by thesplash screen component. csplashwnd::showsplashscreen(this); return 0;}最后将splash.cpp文件中的csplashwnd::create()函数中的位图资源id改为真彩位图的id就可以了。bool csplashwnd::create(cwnd* pparentwnd /*= null*/){ if (!m_bitmap.loadbitmap(idb_bitmap1)) return false; ......}
相关文章推荐
- 孙鑫VC学习笔记:第九讲 界面修改,工具栏,状态栏,启动画面的制作
- VC/MFC如何添加启动界面
- 孙鑫VC学习笔记:第九讲 界面修改,工具栏,状态栏,启动画面的制作
- VC/MFC如何添加启动界面
- VC/MFC如何添加启动界面
- VC/MFC如何添加启动界面
- VC/MFC如何添加启动界面
- VC/MFC如何添加启动界面
- VC/MFC如何添加启动界面
- VC如何制作启动动画
- AngularJS如何在同一个界面启动多个ng-app应用模块
- 使用exe4j制作Java启动程序的的等候界面
- Android开发笔记--制作启动界面splash
- 四种程序启动画面的制作方法(VC)
- [界面]程序启动欢迎窗体(Splash) 制作方法(附原码)
- Android如何制作一个简单的登陆界面
- VC 界面窗口,静态分割后如何锁定分隔条或限制分隔条的移动范围
- 学习vc制作界面
- Ret Hat Linux启动到文字界面+如何使用多个虚拟终端
- 如何启动mininet实例上的wireshark图形界面