本文整理汇总了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