[Vb.net] Console progress bar example, vb.net example
1 Private Sub ConsoleProcessBar () 2 Dim isBreak As Boolean = False 3 Dim colorBack As ConsoleColor = Console. backgroundColor 4 Dim colorFore As ConsoleColor = Console. foregroundColor 5' (0, 0) (Left, Top) the first line of 6 Console. writeLine ("************ TE Mason **************") 7 Console. backgroundColor = ConsoleColor. darkCyan 8 For I = 0 To Console. listen wwidth-3 9' () Second Line 10 Console. write ("") 11 Next12 '(0, 1) Line 2 13 Console. writeLine ("") 14 Console. backgroundColor = colorback15' (0, 2) the third line is 16 Console. writeLine ("0%") 17' () Row 4 18 Console. writeLine ("<Press Enter To Break>") 19 20 For I = 0 To 10021 If Console. keyAvailable AndAlso Console. readKey (True ). key = ConsoleKey. enter Then22 isBreak = True23 Exit For24 End If25 Console. backgroundColor = ConsoleColor. yellow26'/returns the complete quotient, including the remainder. SetCursorPosition is automatically rounded to 27 C. Onsole. setCursorPosition (I * (Console. required wwidth-2)/100, 1) 28 'msgbox (I * (Console. required wwidth-2)/100) 29' MsgBox (Console. cursorLeft) 30' MsgBox (Console. cursorSize) 31 Console. write ("") 32 Console. backgroundColor = colorBack33 Console. foregroundColor = ConsoleColor. green34 Console. setCursorPosition (0, 2) 35 Console. write ("{0} %", I) 36 Console. foregroundColor = colorFore37 Threading. thread. slee P (1000) 38 Next39 40 Console. SetCursorPosition (0, 3) 41 Console. Write (IIf (isBreak, "Break !!! "," Finish ") 42 Console. WriteLine (" ") 43 Console. ReadKey () 44 Console. ReadKey (True) 45 End Sub