VB.Net/GUI/Status Bar
Содержание
Click Button to Set Status Bar Text
Imports System
Imports System.Collections
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class MainClass
Shared Sub Main()
Dim myform As Form = New Form1()
Application.Run(myform)
End Sub
End Class
Public Class Form1
Private Sub copyToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles copyToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Copy button was clicked."
End Sub
Private Sub cutToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cutToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Cut button was clicked."
End Sub
Private Sub helpToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles helpToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Help button was clicked."
End Sub
Private Sub newToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles newToolStripButton.Click
"Update the status bar
sspStatus.Text = "The New button was clicked."
End Sub
Private Sub openToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles openToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Open button was clicked."
End Sub
Private Sub pasteToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles pasteToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Paste button was clicked."
End Sub
Private Sub printToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles printToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Print button was clicked."
End Sub
Private Sub saveToolStripButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles saveToolStripButton.Click
"Update the status bar
sspStatus.Text = "The Save button was clicked."
End Sub
End Class
<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Public Class Form1
Inherits System.Windows.Forms.Form
"Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
"Required by the Windows Form Designer
Private components As System.ruponentModel.IContainer
"NOTE: The following procedure is required by the Windows Form Designer
"It can be modified using the Windows Form Designer.
"Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
" Dim resources As System.ruponentModel.ruponentResourceManager = New System.ruponentModel.ruponentResourceManager(GetType(Form1))
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip
Me.newToolStripButton = New System.Windows.Forms.ToolStripButton
Me.openToolStripButton = New System.Windows.Forms.ToolStripButton
Me.saveToolStripButton = New System.Windows.Forms.ToolStripButton
Me.printToolStripButton = New System.Windows.Forms.ToolStripButton
Me.toolStripSeparator = New System.Windows.Forms.ToolStripSeparator
Me.cutToolStripButton = New System.Windows.Forms.ToolStripButton
Me.copyToolStripButton = New System.Windows.Forms.ToolStripButton
Me.pasteToolStripButton = New System.Windows.Forms.ToolStripButton
Me.toolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator
Me.helpToolStripButton = New System.Windows.Forms.ToolStripButton
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip
Me.sspStatus = New System.Windows.Forms.ToolStripStatusLabel
Me.ToolStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
Me.SuspendLayout()
"
"ToolStrip1
"
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.newToolStripButton, Me.openToolStripButton, Me.saveToolStripButton, Me.printToolStripButton, Me.toolStripSeparator, Me.cutToolStripButton, Me.copyToolStripButton, Me.pasteToolStripButton, Me.toolStripSeparator1, Me.helpToolStripButton})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(292, 25)
Me.ToolStrip1.TabIndex = 0
Me.ToolStrip1.Text = "ToolStrip1"
"
"newToolStripButton
"
Me.newToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.newToolStripButton.Image = CType(resources.GetObject("newToolStripButton.Image"), System.Drawing.Image)
Me.newToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.newToolStripButton.Name = "newToolStripButton"
Me.newToolStripButton.Text = "&New"
"
"openToolStripButton
"
Me.openToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.openToolStripButton.Image = CType(resources.GetObject("openToolStripButton.Image"), System.Drawing.Image)
Me.openToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.openToolStripButton.Name = "openToolStripButton"
Me.openToolStripButton.Text = "&Open"
"
"saveToolStripButton
"
Me.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.saveToolStripButton.Image = CType(resources.GetObject("saveToolStripButton.Image"), System.Drawing.Image)
Me.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.saveToolStripButton.Name = "saveToolStripButton"
Me.saveToolStripButton.Text = "&Save"
"
"printToolStripButton
"
Me.printToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.printToolStripButton.Image = CType(resources.GetObject("printToolStripButton.Image"), System.Drawing.Image)
Me.printToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.printToolStripButton.Name = "printToolStripButton"
Me.printToolStripButton.Text = "&Print"
"
"toolStripSeparator
"
Me.toolStripSeparator.Name = "toolStripSeparator"
"
"cutToolStripButton
"
Me.cutToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.cutToolStripButton.Image = CType(resources.GetObject("cutToolStripButton.Image"), System.Drawing.Image)
Me.cutToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.cutToolStripButton.Name = "cutToolStripButton"
Me.cutToolStripButton.Text = "C&ut"
"
"copyToolStripButton
"
Me.copyToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.copyToolStripButton.Image = CType(resources.GetObject("copyToolStripButton.Image"), System.Drawing.Image)
Me.copyToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.copyToolStripButton.Name = "copyToolStripButton"
Me.copyToolStripButton.Text = "&Copy"
"
"pasteToolStripButton
"
Me.pasteToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.pasteToolStripButton.Image = CType(resources.GetObject("pasteToolStripButton.Image"), System.Drawing.Image)
Me.pasteToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.pasteToolStripButton.Name = "pasteToolStripButton"
Me.pasteToolStripButton.Text = "&Paste"
"
"toolStripSeparator1
"
Me.toolStripSeparator1.Name = "toolStripSeparator1"
"
"helpToolStripButton
"
Me.helpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
" Me.helpToolStripButton.Image = CType(resources.GetObject("helpToolStripButton.Image"), System.Drawing.Image)
Me.helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
Me.helpToolStripButton.Name = "helpToolStripButton"
Me.helpToolStripButton.Text = "He&lp"
"
"StatusStrip1
"
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.sspStatus})
Me.StatusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Table
Me.StatusStrip1.Location = New System.Drawing.Point(0, 251)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(292, 22)
Me.StatusStrip1.TabIndex = 1
Me.StatusStrip1.Text = "StatusStrip1"
"
"sspStatus
"
Me.sspStatus.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
Me.sspStatus.Name = "sspStatus"
Me.sspStatus.Text = "Ready"
"
"Form1
"
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.ToolStrip1)
Me.Controls.Add(Me.StatusStrip1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ToolStrip1.ResumeLayout(False)
Me.StatusStrip1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip
Friend WithEvents newToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents openToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents saveToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents printToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents toolStripSeparator As System.Windows.Forms.ToolStripSeparator
Friend WithEvents cutToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents copyToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents pasteToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents toolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents helpToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
Friend WithEvents sspStatus As System.Windows.Forms.ToolStripStatusLabel
End Class
StatusBar: Icon panel and information panel
Imports System
Imports System.Collections
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Imports System.ruponentModel
Imports System.Drawing.Drawing2D
Imports System.IO
Public Class MainClass
Shared Sub Main()
Dim form1 As Form = New Form1
Application.Run(form1)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
"This call is required by the Windows Form Designer.
InitializeComponent()
"Add any initialization after the InitializeComponent() call
End Sub
"Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
"Required by the Windows Form Designer
Private components As System.ruponentModel.IContainer
"NOTE: The following procedure is required by the Windows Form Designer
"It can be modified using the Windows Form Designer.
"Do not modify it using the code editor.
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.StatusBar1 = New System.Windows.Forms.StatusBar()
Me.SuspendLayout()
"
"StatusBar1
"
Me.StatusBar1.Location = New System.Drawing.Point(0, 94)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.ShowPanels = True
Me.StatusBar1.Size = New System.Drawing.Size(304, 24)
Me.StatusBar1.SizingGrip = False
Me.StatusBar1.TabIndex = 0
"
"Form1
"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)
Me.ClientSize = New System.Drawing.Size(304, 118)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.StatusBar1})
Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "StatusBar Example"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pnlStatus As New StatusBarPanel()
pnlStatus.Text = "Ready"
pnlStatus.Icon = New Icon("test.ico")
pnlStatus.AutoSize = StatusBarPanelAutoSize.Contents
Dim pnlConnection As New StatusBarPanel()
pnlConnection.Text = "Connected to " & "localhost"
pnlConnection.AutoSize = StatusBarPanelAutoSize.Spring
StatusBar1.Panels.Add(pnlStatus)
StatusBar1.Panels.Add(pnlConnection)
End Sub
End Class
Status Bar in Action
Imports System
Imports System.Data
Imports System.Collections
Imports System.Windows.Forms
Public Class MainClass
Shared Sub Main()
Dim form1 As Form = New TextEditor()
Application.Run(form1)
End Sub
End Class
Public Class TextEditor
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
"This call is required by the Windows Form Designer.
InitializeComponent()
"Add any initialization after the InitializeComponent() call
End Sub
"Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
"Required by the Windows Form Designer
Private components As System.ruponentModel.IContainer
"NOTE: The following procedure is required by the Windows Form Designer
"It can be modified using the Windows Form Designer.
"Do not modify it using the code editor.
Friend WithEvents statusBar As System.Windows.Forms.StatusBar
Friend WithEvents toolbar As System.Windows.Forms.ToolBar
Friend WithEvents toolbarClear As System.Windows.Forms.ToolBarButton
Friend WithEvents toolbarRed As System.Windows.Forms.ToolBarButton
Friend WithEvents toolbarBlue As System.Windows.Forms.ToolBarButton
Friend WithEvents toolbarUppercase As System.Windows.Forms.ToolBarButton
Friend WithEvents toolbarLowercase As System.Windows.Forms.ToolBarButton
Friend WithEvents toolbarHelpAbout As System.Windows.Forms.ToolBarButton
Friend WithEvents imglstToolbar As System.Windows.Forms.ImageList
Friend WithEvents txtEdit As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ruponents = New System.ruponentModel.Container()
" Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(TextEditor))
Me.statusBar = New System.Windows.Forms.StatusBar()
Me.toolbar = New System.Windows.Forms.ToolBar()
Me.toolbarClear = New System.Windows.Forms.ToolBarButton()
Me.toolbarRed = New System.Windows.Forms.ToolBarButton()
Me.toolbarBlue = New System.Windows.Forms.ToolBarButton()
Me.toolbarUppercase = New System.Windows.Forms.ToolBarButton()
Me.toolbarLowercase = New System.Windows.Forms.ToolBarButton()
Me.toolbarHelpAbout = New System.Windows.Forms.ToolBarButton()
Me.imglstToolbar = New System.Windows.Forms.ImageList(Me.ruponents)
Me.txtEdit = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
"
"statusBar
"
Me.statusBar.Location = New System.Drawing.Point(0, 397)
Me.statusBar.Name = "statusBar"
Me.statusBar.Size = New System.Drawing.Size(584, 16)
Me.statusBar.TabIndex = 2
"
"toolbar
"
Me.toolbar.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.toolbarClear, Me.toolbarRed, Me.toolbarBlue, Me.toolbarUppercase, Me.toolbarLowercase, Me.toolbarHelpAbout})
Me.toolbar.DropDownArrows = True
Me.toolbar.ImageList = Me.imglstToolbar
Me.toolbar.Name = "toolbar"
Me.toolbar.ShowToolTips = True
Me.toolbar.Size = New System.Drawing.Size(584, 39)
Me.toolbar.TabIndex = 1
"
"toolbarClear
"
Me.toolbarClear.ImageIndex = 4
Me.toolbarClear.Text = "Clear"
Me.toolbarClear.ToolTipText = "Clear the text box"
"
"toolbarRed
"
Me.toolbarRed.ImageIndex = 2
Me.toolbarRed.Text = "Red"
Me.toolbarRed.ToolTipText = "Make the text red"
"
"toolbarBlue
"
Me.toolbarBlue.ImageIndex = 3
Me.toolbarBlue.Text = "Blue"
Me.toolbarBlue.ToolTipText = "Make the text blue"
"
"toolbarUppercase
"
Me.toolbarUppercase.ImageIndex = 0
Me.toolbarUppercase.Text = "Uppercase"
Me.toolbarUppercase.ToolTipText = "Make the text uppercase"
"
"toolbarLowercase
"
Me.toolbarLowercase.ImageIndex = 1
Me.toolbarLowercase.Text = "Lowercase"
Me.toolbarLowercase.ToolTipText = "Make the toolbar lowercase"
"
"toolbarHelpAbout
"
Me.toolbarHelpAbout.ImageIndex = 5
Me.toolbarHelpAbout.Text = "About"
Me.toolbarHelpAbout.ToolTipText = "Display the About box"
"
"imglstToolbar
"
Me.imglstToolbar.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.imglstToolbar.ImageSize = New System.Drawing.Size(16, 16)
" Me.imglstToolbar.ImageStream = CType(resources.GetObject("imglstToolbar.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.imglstToolbar.TransparentColor = System.Drawing.Color.Transparent
"
"txtEdit
"
Me.txtEdit.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right)
Me.txtEdit.Location = New System.Drawing.Point(8, 48)
Me.txtEdit.Multiline = True
Me.txtEdit.Name = "txtEdit"
Me.txtEdit.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtEdit.Size = New System.Drawing.Size(568, 340)
Me.txtEdit.TabIndex = 1
Me.txtEdit.Text = ""
"
"TextEditor
"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(584, 413)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtEdit, Me.toolbar, Me.statusBar})
Me.Name = "TextEditor"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Public Property StatusText() As String
Get
Return statusBar.Text
End Get
Set(ByVal Value As String)
statusBar.Text = Value
End Set
End Property
Public Property EditText() As String
Get
Return txtEdit.Text
End Get
Set(ByVal Value As String)
txtEdit.Text = Value
End Set
End Property
Public Sub ClearEditBox()
EditText = ""
txtEdit.ForeColor = System.Drawing.Color.Black
StatusText = "Text box cleared"
End Sub
Private Sub txtEdit_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtEdit.TextChanged
StatusText = "Ready"
End Sub
Private Sub toolbar_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles toolbar.ButtonClick
If e.Button Is toolbarClear Then
ClearEditBox()
End If
If e.Button Is toolbarRed Then
RedText()
End If
If e.Button Is toolbarBlue Then
BlueText()
End If
If e.Button Is toolbarUppercase Then
UppercaseText()
End If
If e.Button Is toolbarLowercase Then
LowercaseText()
End If
If e.Button Is toolbarHelpAbout Then
ShowAboutBox()
End If
End Sub
Public Sub UppercaseText()
EditText = EditText.ToUpper
StatusText = "The text is all uppercase"
End Sub
Public Sub LowercaseText()
EditText = EditText.ToLower
StatusText = "The text is all lowercase"
End Sub
Public Sub RedText()
txtEdit.ForeColor = System.Drawing.Color.Red
StatusText = "The text is red"
End Sub
Public Sub BlueText()
txtEdit.ForeColor = System.Drawing.Color.Blue
StatusText = "The text is blue"
End Sub
Public Sub ShowAboutBox()
MessageBox.Show("About")
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class
Status Bar with a fake Button
Imports System
Imports System.ruponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Public Class MainClass
Shared Sub Main()
Dim myform As Form = New OwnerDrawnStatusBar()
Application.Run(myform)
End Sub
End Class
Public Class OwnerDrawnStatusBar
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
"This call is required by the Windows Form Designer.
InitializeComponent()
"Add any initialization after the InitializeComponent() call
End Sub
"Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
"Required by the Windows Form Designer
Private components As System.ruponentModel.IContainer
"NOTE: The following procedure is required by the Windows Form Designer
"It can be modified using the Windows Form Designer.
"Do not modify it using the code editor.
Friend WithEvents statusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents statusBarPanel1 As System.Windows.Forms.StatusBarPanel
Friend WithEvents statusBarPanel2 As System.Windows.Forms.StatusBarPanel
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.statusBar1 = New System.Windows.Forms.StatusBar()
Me.statusBarPanel1 = New System.Windows.Forms.StatusBarPanel()
Me.statusBarPanel2 = New System.Windows.Forms.StatusBarPanel()
CType(Me.statusBarPanel1, System.ruponentModel.ISupportInitialize).BeginInit()
CType(Me.statusBarPanel2, System.ruponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
"
"statusBar1
"
Me.statusBar1.Location = New System.Drawing.Point(0, 234)
Me.statusBar1.Name = "statusBar1"
Me.statusBar1.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.statusBarPanel1, Me.statusBarPanel2})
Me.statusBar1.ShowPanels = True
Me.statusBar1.Size = New System.Drawing.Size(292, 32)
Me.statusBar1.TabIndex = 4
Me.statusBar1.Text = "statusBar1"
"
"statusBarPanel1
"
Me.statusBarPanel1.Text = "Next Panel is OwnerDrawn -->"
Me.statusBarPanel1.Width = 190
"
"statusBarPanel2
"
Me.statusBarPanel2.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw
Me.statusBarPanel2.Text = "statusBarPanel2"
Me.statusBarPanel2.Width = 113
"
"OwnerDrawnStatusBar
"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.statusBar1})
Me.Name = "OwnerDrawnStatusBar"
Me.Text = "OwnerDrawnStatusBar"
CType(Me.statusBarPanel1, System.ruponentModel.ISupportInitialize).EndInit()
CType(Me.statusBarPanel2, System.ruponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub statusBar1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles statusBar1.DrawItem
Dim brush As Brush = New SolidBrush(e.ForeColor)
Dim format As StringFormat = New StringFormat()
format.Alignment = StringAlignment.Center
format.LineAlignment = StringAlignment.Center
e.Graphics.DrawRectangle(New Pen(e.BackColor), e.Bounds)
ControlPaint.DrawButton(e.Graphics, e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 10, e.Bounds.Height - 10, ButtonState.Normal)
e.Graphics.DrawString("A fake button", e.Font, brush, RectangleF.op_Implicit(e.Bounds), format)
brush.Dispose()
End Sub
End Class