日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ProgressBar 类

發(fā)布時(shí)間:2024/4/17 编程问答 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ProgressBar 类 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ProgressBar?控件以三種樣式中的一種指示較長操作的進(jìn)度:

  • 從左向右分步遞增的分段塊。

  • 從左向右填充的連續(xù)欄。

  • 以字幕方式在?ProgressBar?中滾動(dòng)的塊。

Style?屬性確定顯示的?ProgressBar?的樣式。注意,ProgressBar?控件只能是水平方向的。有關(guān)如何創(chuàng)建垂直方向的?ProgressBar?的示例,請(qǐng)參見?ProgressBarRenderer?類。ProgressBar?控件通常在應(yīng)用程序執(zhí)行諸如復(fù)制文件或打印文檔等任務(wù)時(shí)使用。如果沒有視覺提示,應(yīng)用程序的用戶可能會(huì)認(rèn)為應(yīng)用程序不響應(yīng)。通過在應(yīng)用程序中使用?ProgressBar,可以警告用戶應(yīng)用程序正在執(zhí)行冗長的任務(wù)且應(yīng)用程序仍在響應(yīng)。

Maximum?和?Minimum?屬性定義了兩個(gè)值的范圍用以表現(xiàn)任務(wù)的進(jìn)度。Minimum?屬性通常設(shè)置為值 0,Maximum?屬性通常設(shè)置為指示任務(wù)完成的值。例如,若要正確顯示復(fù)制一組文件時(shí)的進(jìn)度,Maximum?屬性應(yīng)設(shè)置成要復(fù)制的文件的總數(shù)。

Value?屬性表示應(yīng)用程序在完成操作的過程中的進(jìn)度。ProgressBar?顯示的值僅僅是近似于?Value?屬性的當(dāng)前值。根據(jù)?ProgressBar?的大小,Value?屬性確定何時(shí)顯示下一個(gè)塊或增加欄大小。

除了直接更改?Value?屬性之外還有許多方式可以修改由?ProgressBar?顯示的值。可以使用?Step?屬性指定一個(gè)特定值用以逐次遞增?Value?屬性的值,然后調(diào)用?PerformStep?方法來使該值遞增。若要更改增量值,可以使用?Increment?方法并指定一個(gè)用來遞增?Value?屬性的值。

private void CopyWithProgress(string[] filenames) {// Display the ProgressBar control.pBar1.Visible = true;// Set Minimum to 1 to represent the first file being copied.pBar1.Minimum = 1;// Set Maximum to the total number of files to copy.pBar1.Maximum = filenames.Length;// Set the initial value of the ProgressBar.pBar1.Value = 1;// Set the Step property to a value of 1 to represent each file being copied.pBar1.Step = 1;// Loop through all files to copy.for (int x = 1; x <= filenames.Length; x++){// Copy the file and increment the ProgressBar if successful.if(CopyFile(filenames[x-1]) == true){// Perform the increment on the ProgressBar.pBar1.PerformStep();}} }

轉(zhuǎn)載于:https://www.cnblogs.com/wpf123/archive/2011/09/08/2171259.html

總結(jié)

以上是生活随笔為你收集整理的ProgressBar 类的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。