偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

詳細分析VB Update方法

開發(fā) 后端
這里介紹VB Update方法使用一個值作參數(shù),我設置成員m_currentValue,然后計算m_currentBarLength。計算的結(jié)果為進度條當前應該覆蓋的列數(shù)。

本文向大家介紹VB Update方法,可能好多人還不了解VB Update方法,沒有關系,看完本文你肯定有不少收獲,希望本文能教會你更多東西。在VB Update方法被調(diào)用前,在ConsoleProgressBar對象中什么也沒有發(fā)生:

  1. Public Sub Update(ByVal CurrentValue As Long)  
  2. m_currentValue = CurrentValue 
  3. m_currentBarLength = CInt((m_currentValue / m_maximumValue) * m_length)  
  4. Refresh()  
  5. End Sub  

這個VB Update方法使用一個值作參數(shù)(在此是指當前剛剛復制的文件數(shù))。我設置成員m_currentValue,然后計算m_currentBarLength。計算的結(jié)果為進度條當前應該覆蓋的列數(shù)。

最后,我調(diào)用Refresh方法,它又調(diào)用UpdatePercentComplete、UpdateProgressBar和UpdateMessageBar方法。

因為所有這三個方法功能相類似,所以我將集中討論UpdateProgressBar方法:

  1. Private Sub UpdateProgressBar()  
  2. Dim originalForegroundColor As ConsoleConsoleColor = Console.ForegroundColor  
  3. Dim originalBackgroundColor As ConsoleConsoleColor = Console .BackgroundColor  
  4. Console.ForegroundColor = ConsoleColor.Black  
  5. Console.BackgroundColor = ConsoleColor.Green  
  6. Console.SetCursorPosition(m_left + 1 m_progressBarRow)  
  7. Dim progress As New String("O", m_currentBarLength)  
  8. Console.Write(progress)  
  9. Console.ForegroundColor =originalForegroundColor 
  10. Console.BackgroundColor = originalBackgroundColor 
  11. End Sub  

首先,該代碼保存當前的前景和背景顏色。然后,它把ForegroundColor屬性設置為黑色,把BackgroundColor屬性設置為綠色。在把光標放置到進度條的左邊緣后,它打印一串長度為m_currentBarLength的“O”。

其它問題

這個DirCopy應用程序,雖然有些用處,但是還遠非成品。為了使其更為強壯,還需要增加大量的錯誤處理方式。你還可以改進ConsoleProgressBar類以實現(xiàn)更靈活的控制。下列是一些可能的改進:
◆允許控制進度條的位置和長度
◆允許百分比完成區(qū)域放到你選擇的任何位置
◆允許定制進度條中的消息
◆添加一個選項以選擇水平的或垂直的進度條

【編輯推薦】

  1. VB 2005中開發(fā)新一代控制臺應用程序
  2. 簡單講解VB開發(fā)分布式
  3. 淺析VB Script開發(fā)自動化測試
  4. 淺談VB開發(fā)系統(tǒng)知識
  5. VB.NET應用程序中多線程的應用實例
責任編輯:佚名 來源: 比特網(wǎng)
相關推薦

2009-10-28 10:06:29

VB.NET With

2009-10-12 15:41:09

VB.NET動態(tài)代碼

2009-10-10 15:19:43

VB.NET Web

2009-09-28 10:39:01

Hibernate基礎

2009-09-25 14:23:39

2010-01-07 17:00:38

VB.NET控件數(shù)組

2009-10-14 10:25:52

VB.NET讀寫文本文

2009-09-09 09:48:43

Linq延遲加載

2009-09-14 16:21:34

LINQ To XML

2009-06-18 14:00:51

2009-09-14 13:50:35

LINQ編程模型

2009-11-20 13:11:44

Oracle XML數(shù)

2009-09-08 15:56:50

Linq使用Group

2010-01-06 13:50:37

.NET Framew

2010-04-26 18:17:19

Oracle存儲過程

2009-12-07 15:37:00

WCF控件

2009-03-24 08:30:54

AndroidGoogle移動os

2009-09-07 13:19:44

C#線程同步

2009-09-03 17:57:06

C#聲明事件

2009-09-04 15:43:07

C#流模型
點贊
收藏

51CTO技術棧公眾號