本文整理汇总了VB.NET中System.Console.WindowLeft属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Console.WindowLeft属性的具体用法?VB.NET Console.WindowLeft怎么用?VB.NET Console.WindowLeft使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Console
的用法示例。
在下文中一共展示了Console.WindowLeft属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Example
Module Example
Public Sub Main()
Dim key As ConsoleKeyInfo
Dim moved As Boolean = False
Console.BufferWidth = 120
Console.Clear()
ShowConsoleStatistics()
Do While True
key = Console.ReadKey(True)
If key.Key = ConsoleKey.LeftArrow Then
Dim pos As Integer = Console.WindowLeft - 1
If pos >= 0 And pos + Console.WindowWidth <= Console.BufferWidth Then
Console.WindowLeft = pos
moved = True
End If
ElseIf key.Key = ConsoleKey.RightArrow Then
Dim pos As Integer = Console.WindowLeft + 1
If pos + Console.WindowWidth <= Console.BufferWidth Then
Console.WindowLeft = pos
moved = True
End If
End If
If moved Then ShowConsoleStatistics() : moved = False
Console.WriteLine()
Loop
End Sub
Private Sub ShowConsoleStatistics()
Console.WriteLine("Console statistics:")
Console.WriteLine(" Buffer: {0} x {1}", Console.BufferHeight, Console.BufferWidth)
Console.WriteLine(" Window: {0} x {1}", Console.WindowHeight, Console.WindowWidth)
Console.WriteLine(" Window starts at {0}.", Console.WindowLeft)
Console.WriteLine("Press <- or -> to move window, Ctrl+C to exit.")
End Sub
End Module