Custom Control -StatusBar.

  • Thread starter Thread starter garfitz
  • Start date Start date
G

garfitz

I am trying to create a custom control for a statusbar (set to red for erros etc..)

My test project has a blank form and a ColorStatusBar class.
Nothing is having an effect on the color of the statusbar!
Where am I going wrong ?

The ColorStatusBar class has the following code;

Public Class StatusBarRed
Inherits StatusBar
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)

Me.BackColor = Color.Blue
Me.ForeColor = Color.Red
MyBase.OnPaint(pe)

End Sub
End Class

My blank form has the following code after the initialize component section.

'Add any initialization after the InitializeComponent() call
Dim StatusBar1 As New ColourStatusBar.StatusBarRed
StatusBar1.Location = New System.Drawing.Point(0, 248)
StatusBar1.Size = New System.Drawing.Size(240, 22)
StatusBar1.Text = "StatusBar1"
Me.Controls.Add(StatusBar1)
 
Isn't it true that StatusBar does not expose the OnPaint event and that a
ColorStatusBar should be derived from Control?

--
Regards,

Maarten Struys
PTS Software bv
 
You're right. Sorry, I missed that. He'd need to derive
his control from Control...

-Alex
 
Back
Top