如何製作啟動介面 C+/VC

來源:互聯網
上載者:User
 如何製作啟動介面 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;        ......}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.