自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

詳細(xì)分析VB Update方法

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

本文向大家介紹VB Update方法,可能好多人還不了解VB Update方法,沒(méi)有關(guān)系,看完本文你肯定有不少收獲,希望本文能教會(huì)你更多東西。在VB Update方法被調(diào)用前,在ConsoleProgressBar對(duì)象中什么也沒(méi)有發(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  

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

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

因?yàn)樗羞@三個(gè)方法功能相類似,所以我將集中討論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  

首先,該代碼保存當(dāng)前的前景和背景顏色。然后,它把ForegroundColor屬性設(shè)置為黑色,把BackgroundColor屬性設(shè)置為綠色。在把光標(biāo)放置到進(jìn)度條的左邊緣后,它打印一串長(zhǎng)度為m_currentBarLength的“O”。

其它問(wèn)題

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

【編輯推薦】

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

2009-10-28 10:06:29

VB.NET With

2009-10-10 15:19:43

VB.NET Web

2009-10-12 15:41:09

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

2009-09-25 14:23:39

2009-09-28 10:39:01

Hibernate基礎(chǔ)

2010-01-07 17:00:38

VB.NET控件數(shù)組

2009-06-18 14:00:51

2009-09-09 09:48:43

Linq延遲加載

2009-09-14 16:21:34

LINQ To XML

2009-10-14 10:25:52

VB.NET讀寫(xiě)文本文

2009-09-14 13:50:35

LINQ編程模型

2009-09-08 15:56:50

Linq使用Group

2009-11-20 13:11:44

Oracle XML數(shù)

2010-01-06 13:50:37

.NET Framew

2009-09-07 13:19:44

C#線程同步

2009-09-04 15:43:07

C#流模型

2009-12-07 15:37:00

WCF控件

2010-04-26 18:17:19

Oracle存儲(chǔ)過(guò)程

2009-03-24 08:30:54

AndroidGoogle移動(dòng)os

2009-09-03 17:57:06

C#聲明事件
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)