本文整理匯總了VB.NET中System.Drawing.StringFormat.GetTabStops方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET StringFormat.GetTabStops方法的具體用法?VB.NET StringFormat.GetTabStops怎麽用?VB.NET StringFormat.GetTabStops使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了StringFormat.GetTabStops方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Pen
Public Sub GetSetTabStopsExample1(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Tools used for drawing, painting.
Dim redPen As New Pen(Color.FromArgb(255, 255, 0, 0))
Dim blueBrush As New SolidBrush(Color.FromArgb(255, 0, 0, 255))
' Layout and format for text.
Dim myFont As New Font("Times New Roman", 12)
Dim myStringFormat As New StringFormat
Dim enclosingRectangle As New Rectangle(20, 20, 500, 100)
Dim tabStops As Single() = {150.0F, 100.0F, 100.0F}
' Text with tabbed columns.
Dim myString As String = "Name" & ControlChars.Tab & "Tab 1" _
& ControlChars.Tab & "Tab 2" & ControlChars.Tab & "Tab 3" _
& ControlChars.Cr & "George Brown" & ControlChars.Tab & "One" _
& ControlChars.Tab & "Two" & ControlChars.Tab & "Three"
' Set the tab stops, paint the text specified by myString,the
' and draw rectangle that encloses the text.
myStringFormat.SetTabStops(0.0F, tabStops)
g.DrawString(myString, myFont, blueBrush, _
RectangleF.op_Implicit(enclosingRectangle), myStringFormat)
g.DrawRectangle(redPen, enclosingRectangle)
' Get the tab stops.
Dim firstTabOffset As Single
Dim tabStopsObtained As Single() = _
myStringFormat.GetTabStops(firstTabOffset)
Dim j As Integer
For j = 0 To tabStopsObtained.Length - 1
' Inspect or use the value in tabStopsObtained[j].
Console.WriteLine(ControlChars.Cr & " Tab stop {0} = {1}", _
j, tabStopsObtained(j))
Next j
End Sub