進度條控制項CProgressCtrl實現進度滾動效果

來源:互聯網
上載者:User

標籤:

關於CProgressCtrl 控制項的基本操作網上有很多資料,可我想實現進度條中進度滾動效果,即很多時候程式出現的等待或啟動畫面,如:

 

實現這個效果的函數為SetMarquee(_In_ BOOL fMarqueeMode, _In_ int nInterval),第一個參數為開關,第二個參數指定滾動時間。且控制項應該包含
PBS_MARQUEE風格,eg:
m_ProgressCtl.Create(WS_CHILD|WS_VISIBLE|PBS_MARQUEE,CRect(100,200,250,230),this,11);
m_ProgressCtl.SetMarquee(TRUE, 30);

如果在win32下使用帶PBS_MARQUEE風格的Progress Bar進度條控制項的話還需要指定程式使用的ComCtl32庫的版本必須為6.0或以上,因為這個控制項陳列庫會隨
著Internet Explorer發布,所以當前活動的ComCtl32版本很可能與作業系統的版本不一樣,所以我們應該手動指定程式使用的ComCtl32版本:

#if defined _M_IX86#pragma comment(linker, "/manifestdependency:\"type=‘win32‘ name=‘Microsoft.Windows.Common-Controls‘ version=‘6.0.0.0‘ processorArchitecture=‘x86‘ publicKeyToken=‘6595b64144ccf1df‘ language=‘*‘\"")#elif defined _M_IA64#pragma comment(linker, "/manifestdependency:\"type=‘win32‘ name=‘Microsoft.Windows.Common-Controls‘ version=‘6.0.0.0‘ processorArchitecture=‘ia64‘ publicKeyToken=‘6595b64144ccf1df‘ language=‘*‘\"")#elif defined _M_X64#pragma comment(linker, "/manifestdependency:\"type=‘win32‘ name=‘Microsoft.Windows.Common-Controls‘ version=‘6.0.0.0‘ processorArchitecture=‘amd64‘ publicKeyToken=‘6595b64144ccf1df‘ language=‘*‘\"")#else#pragma comment(linker, "/manifestdependency:\"type=‘win32‘ name=‘Microsoft.Windows.Common-Controls‘ version=‘6.0.0.0‘ processorArchitecture=‘*‘ publicKeyToken=‘6595b64144ccf1df‘ language=‘*‘\"")#endif

我們在建立MFC項目的時候會看到有一個“Common control manifest”選項,如果我們去掉選擇它的話會發現程式的一些控制項都是一些老式風格,這其
實就是使用了低版本的ComCtl32庫,所以在win32中,如果想要控制項風格為新的系統風格那麼應該指定使用的ComCtl32版本。

win32控制項一覽:https://msdn.microsoft.com/en-us/library/bb773169(v=vs.85).aspx

 

進度條控制項CProgressCtrl實現進度滾動效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.