封裝乙個進度條

2021-09-06 14:54:53 字數 2502 閱讀 7888

1.首先定義乙個處理資料需要產生進度的介面和抽象類

1

namespace

progress.core

26 posscesscompleted mposscesscompleted

7 thread mthread

8bool isstop

9void

start();10}

11public

delegate

void

posscesscompleted();

12public

class

abstractprogress : iprogress

1321}22

public iprogressview m_frmprogress

23public

bool isstop

2425

26public posscesscompleted mposscesscompleted

2728

public

abstractprogress()

2932

bool isstart = false;33

public

void

start()

3440}41

private

void

workfunc()

4247

processdata();

48//

處理完成

49if (mposscesscompleted != null)50

53}54public

virtual

void

processdata()

5558}59

60 }

iprogress

看乙個子類實現:

1

class

numcul : abstractprogress

212 i++;

13m_frmprogress.settitle(i.tostring());

14 m_frmprogress.setprocessbar(i / 100

);15

if (i > 10000)16

19}20}

21 }

numcul

2.進度條窗體的抽象介面:

1

public

inte***ce

iprogressview

2

iprogressview

乙個進度條窗體實現:

1

public

partial

class

frmprogress : form, iprogressview221

22private

void frmprogress_load(object

sender, eventargs e)

2330

public

bool isfalse = true;31

//給處理執行緒呼叫的

32public

void settitle(string

title)

3337

//給處理執行緒呼叫的

38public

void setprocessbar(int

percent)

3942

public

void

iscompeted()

4346

47void settitlestate(string

title)

4851

void setprogressbarstate(int

percent)

5255

void

setbuttonstate()

5660

61private

void button1_click(object

sender, eventargs e)

6267

this

.close();68}

6970

private

void frmprogress_formclosing(object

sender, formclosingeventargs e)

7176}77

78 }

進度條窗體

3.呼叫:

封裝乙個圓形進度條jQuery外掛程式

function 1.設定預設值 var defaults 2.傳入的物件覆蓋預設物件 for var key in options 百分比換算成角度值 var deg 360 100 defaults.number 2.計算動畫的時間 一度的時間 var onetime defaults.time...

簡單封裝的乙個彩色進度條 原創

class cgradientprogressctrl public cprogressctrl 顯示百分比 void showtext bool bshowtext true 顯示文字 public colorref gettextcolor void 取得字型顏色 colorref getbkc...

實現乙個彩色進度條

顯示序列 033 0m 關閉轉義序列 033 1m 粗體或高亮 033 5m 閃爍 前景顏色序列 033 30m 黑 033 31m 紅 033 32m 綠 033 33m 黃 033 34m 藍 033 35m 洋紅 033 36m 青 033 37m 白 背景顏色序列 與前景顏色對對應,前景色是...