本文整理汇总了VB.NET中System.Console.CursorVisible属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Console.CursorVisible属性的具体用法?VB.NET Console.CursorVisible怎么用?VB.NET Console.CursorVisible使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Console
的用法示例。
在下文中一共展示了Console.CursorVisible属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Sample
' This example demonstrates the Console.CursorVisible property.
Class Sample
Public Shared Sub Main()
Dim m1 As String = vbCrLf & "The cursor is {0}." & _
vbCrLf & "Type any text then press Enter. " & _
"Type '+' in the first column to show " & _
vbCrLf & "the cursor, '-' to hide the cursor, " & _
"or lowercase 'x' to quit:"
Dim s As String
Dim saveCursorVisibile As Boolean
Dim saveCursorSize As Integer
'
Console.CursorVisible = True ' Initialize the cursor to visible.
saveCursorVisibile = Console.CursorVisible
saveCursorSize = Console.CursorSize
Console.CursorSize = 100 ' Emphasize the cursor.
While True
Console.WriteLine(m1, _
IIf(Console.CursorVisible = True, "VISIBLE", "HIDDEN"))
s = Console.ReadLine()
If String.IsNullOrEmpty(s) = False Then
If s(0) = "+"c Then
Console.CursorVisible = True
ElseIf s(0) = "-"c Then
Console.CursorVisible = False
ElseIf s(0) = "x"c Then
Exit While
End If
End If
End While
Console.CursorVisible = saveCursorVisibile
Console.CursorSize = saveCursorSize
End Sub
End Class
'
'This example produces the following results. Note that these results
'cannot depict cursor visibility. You must run the example to see the
'cursor behavior:
'
'The cursor is VISIBLE.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'The quick brown fox
'
'The cursor is VISIBLE.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'-
'
'The cursor is HIDDEN.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'jumps over
'
'The cursor is HIDDEN.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'+
'
'The cursor is VISIBLE.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'the lazy dog.
'
'The cursor is VISIBLE.
'Type any text then press Enter. Type '+' in the first column to show
'the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
'x
'