當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET ProgressBar.Minimum屬性代碼示例

本文整理匯總了VB.NET中System.Windows.Forms.ProgressBar.Minimum屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ProgressBar.Minimum屬性的具體用法?VB.NET ProgressBar.Minimum怎麽用?VB.NET ProgressBar.Minimum使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在System.Windows.Forms.ProgressBar的用法示例。


在下文中一共展示了ProgressBar.Minimum屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: CopyWithProgress

Private Sub CopyWithProgress(ByVal ParamArray filenames As String())
    ' 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.
    Dim x As Integer
    for x = 1 To filenames.Length - 1
        ' Copy the file and increment the ProgressBar if successful.
        If CopyFile(filenames(x - 1)) = True Then
            ' Perform the increment on the ProgressBar.
            pBar1.PerformStep()
        End If
    Next x
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Windows.Forms,代碼行數:22,代碼來源:ProgressBar.Minimum

示例2: New

Option Strict On
imports System
imports System.Drawing
imports System.Windows.Forms

public class ProgressBars : inherits Form

  dim pb as ProgressBar
  dim lbl as Label

  public sub New()
    Size = new Size(300,200)

    dim btn as new Button()
    btn.Parent = me
    btn.Text = "&Start"
    btn.Location = new Point(0,0)
    AddHandler btn.Click, AddressOf btn_OnClick

    lbl = new Label()
    lbl.Parent = me
    lbl.Size = new Size(100,23)
    lbl.Location = new Point(0,25)
    lbl.BorderStyle = BorderStyle.FixedSingle
    lbl.TextAlign = ContentAlignment.MiddleCenter
    lbl.Text = ""

    pb = new ProgressBar()
    pb.Parent = me
    pb.Location = new Point(0, 70)
    pb.Size = new Size(400, 20) 
    pb.Minimum = 0      '  the default value
    pb.Maximum = 100    '  the default value
  end sub  '  close for constructor

  private sub btn_OnClick(ByVal sender as object,ByVal e as EventArgs)
    dim cntr as integer = 0
    pb.Value = 0
    pb.Step = 1
    for i as integer = 0 to 100000
      cntr  = cntr + 1
      if cntr mod 100 = 0 then
        lbl.Text = cntr.ToString()
        pb.PerformStep()
        Application.DoEvents()
        System.Threading.Thread.Sleep(40)
      end if
    next
  end sub

  public shared sub Main() 
    Application.Run(new ProgressBars())
  end sub

end class
開發者ID:VB程序員,項目名稱:System.Windows.Forms,代碼行數:55,代碼來源:ProgressBar.Minimum


注:本文中的System.Windows.Forms.ProgressBar.Minimum屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。