歡迎介面進度條顯示

2021-07-24 18:53:18 字數 2553 閱讀 9111

程式設計中,為了使我們的軟體更加人性化,需要乙個歡迎介面,顯示乙個幾秒鐘的動畫。

1.首先貼圖,貼上背景和進度條

2.然後設定進度條動畫顯示

4.將進度條放置在背景下一層顯示

這樣我們就能看到乙個簡單帶有進度條的歡迎介面了

.h檔案

private:

int m_nstep;

image *m_pimagebackground;

int m_nbackgroundwidth, m_nbackgroundheight;

image *m_pimageprogress;

int m_nprogresswidth, m_nprogressheight;

private:

void myinitdialog();

void initui();//設定介面初始化資訊

void getimagesource();//獲取資訊

void mypaint();

void drawbackground(hdc hdc);//繪製背景

void drawprogress(hdc hdc);//繪製

//獲取資訊

bool imagefromidresource(uint nid, lpctstr str, image *&pimg);

bool imagefromidresource(cstring sfilepathname, image *&pimg);

public:

afx_msg void ontimer(uint_ptr nidevent);

.cpp檔案

dcmem.deletedc();

} else

if(ay <=0 )

else

rect clientrect;

clientrect.left = ax;

clientrect.top = ay;

clientrect.right = clientrect.left + nbkbmpwidth;

clientrect.bottom = clientrect.top + nbkbmpheight;

movewindow(&clientrect);};

graphics graph(hdc);

point points = ;

graph.drawimage(m_pimagebackground, points, 3);

graph.releasehdc(hdc);};

graphics graph(hdc);

int nhoroffset = 50;

int nveroffset = 100;

nhoroffset = -400 + m_nstep*40;

point points = ;

graph.drawimage(m_pimageprogress, points, 3);

graph.releasehdc(hdc);

} cdialog::ontimer(nidevent);

} len=getfilesize(hfile,&size1);

if(0xffffffff == len)

// allocate global memory on which to create stream

hglobal m_hmem = globalalloc(gmem_fixed, len);

byte* pmem = (byte*)globallock(m_hmem);

readfile(hfile,pmem,len,&readbyte,null);

istream* pstm;

createstreamonhglobal(m_hmem,false,&pstm);

// load from stream

pimg=gdiplus::image::fromstream(pstm);

// free/release stuff

globalunlock(m_hmem);

pstm->release();

return true;

}

進度條顯示

最近的專案需求中涉及到了顯示進度的圖示,因此就簡單實現了一下,拿出來獻醜了 方法實現很簡單,主要是使用了framelayout的特殊性來實現的疊加顯示的 有次需求的同學們可以參考一下呦3 成功的 失敗的 進行中的 初始化 param attrs private void initview attri...

安卓跨介面顯示進度條

在專案中推進中需要新增介面和介面之間的進度條顯示,這裡給出寫法。這裡假設頁面1跳轉到頁面2,先給出 結合 給出解釋 以下為頁面1中的關鍵 其中需要提前定義靜態進度條變數p,private static progressdialog p final handler handler2 new handl...

如何顯示進度條?

在許多程式中,程式需要自己做些事情而不受使用者輸入的干擾。這時就需要給使用者一些可見的顯示,以表明程式正在做一些事情及完成的進度。在wxpython中,這通常使用乙個進度條來管理,如圖9.5所示。圖9.5 例9.5顯示了產生圖9.5的 例9.5 生成乙個進度條 import wx if name m...