本文整理匯總了VB.NET中System.Windows.Forms.StatusBar.OnDrawItem方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET StatusBar.OnDrawItem方法的具體用法?VB.NET StatusBar.OnDrawItem怎麽用?VB.NET StatusBar.OnDrawItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.StatusBar
的用法示例。
在下文中一共展示了StatusBar.OnDrawItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: StringFormat
Private Sub StatusBar1_DrawItem(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles StatusBar1.DrawItem
' Create a StringFormat object to align text in the panel.
Dim sf As New StringFormat()
' Format the String of the StatusBarPanel to be centered.
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
' Draw a black background in owner-drawn panel.
sbdevent.Graphics.FillRectangle(Brushes.Black, sbdevent.Bounds)
' Draw the current date (short date format) with white text in the control's font.
sbdevent.Graphics.DrawString(DateTime.Today.ToShortDateString(), StatusBar1.Font, Brushes.White, _
New RectangleF(sbdevent.Bounds.X, sbdevent.Bounds.Y, _
sbdevent.Bounds.Width, sbdevent.Bounds.Height), sf)
End Sub