473,511 Members | 10,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StatusBar.BackColor = Color.Yellow fails

OK, the direct method of setting the background color on a text-only (no
panels) statusbar control seems to fail:

Me.StatusBar1.Text = "<whatever> failed.>
Me.StatusBar1.Backcolor = Color.Yellow ' nothing changes
Me.StatusBar1.Refresh ' doesn't help either.

What convoluted work-around (must be if the simple, direct method fails) is
there for this?
Nov 20 '05 #1
3 2937
* "Fred Morrison" <fm*******@erols.com> scripsit:
OK, the direct method of setting the background color on a text-only (no
panels) statusbar control seems to fail:

Me.StatusBar1.Text = "<whatever> failed.>
Me.StatusBar1.Backcolor = Color.Yellow ' nothing changes
Me.StatusBar1.Refresh ' doesn't help either.


This property is not implemented for the StatusBar control. You may
want to define an ownerdrawn panel and draw its background by handling
the panel's 'DrawItem' event.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
I found this online somewhere, hope this helps

Public Class ColoredStatusBar

Inherits StatusBar

Private m_BackColor As Color = Color.Blue

Public Sub New()

MyBase.New()

Me.SetStyle(ControlStyles.UserPaint, True)

Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)

End Sub

Public Shadows Property BackColor() As Color

Get

Return m_BackColor

End Get

Set(ByVal Value As Color)

m_BackColor = Value

Me.Invalidate()

End Set

End Property

Protected Overrides Sub OnPaint( _

ByVal e As System.Windows.Forms.PaintEventArgs)

e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), _

e.ClipRectangle)

e.Graphics.DrawString(Me.Text, Me.Font, New SolidBrush(Me.ForeColor), _

e.ClipRectangle.X, e.ClipRectangle.Y)

If Me.SizingGrip = True Then

ControlPaint.DrawSizeGrip(e.Graphics, Me.BackColor, e.ClipRectangle)

End If

End Sub

End Class

"Fred Morrison" <fm*******@erols.com> wrote in message
news:en*************@TK2MSFTNGP11.phx.gbl...
OK, the direct method of setting the background color on a text-only (no
panels) statusbar control seems to fail:

Me.StatusBar1.Text = "<whatever> failed.>
Me.StatusBar1.Backcolor = Color.Yellow ' nothing changes
Me.StatusBar1.Refresh ' doesn't help either.

What convoluted work-around (must be if the simple, direct method fails) is there for this?

Nov 20 '05 #3
http://www.dotnet247.com/247reference/msgs/9/45667.aspx

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
* "Fred Morrison" <fm*******@erols.com> scripsit:
OK, the direct method of setting the background color on a text-only (no
panels) statusbar control seems to fail:

Me.StatusBar1.Text = "<whatever> failed.>
Me.StatusBar1.Backcolor = Color.Yellow ' nothing changes
Me.StatusBar1.Refresh ' doesn't help either.


This property is not implemented for the StatusBar control. You may
want to define an ownerdrawn panel and draw its background by handling
the panel's 'DrawItem' event.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
382
by: ron | last post by:
I have several TextBoxes on a Web Form. When I run the project the background color of some of the TextBoxes changes to a "yellowish" color. Changing the BackColor property of these TextBoxes...
4
17200
by: Dave | last post by:
Hi, Can anyone tell me the correct syntax when using a variable to control the color property? This works ok: If ABC2flash Then Label61.BackColor = Color.Yellow This doesn't, showing...
3
4784
by: pepino13 | last post by:
Hello, I have a a form called frmMissyFact, I have copied this form and called it frmMissyFactBackup which reads data from a backup database of the week before. I brought frmMissyFactBackup into...
1
2497
by: Matt | last post by:
I am wanting to have the backcolor of some combo boxes change acording to what value is in the combo boxes in a report. The report can be one page to multiple pages with the same combo boxes on...
0
1011
by: Tom | last post by:
The backcolor property of the statusbar is overridden. I've tried to change the color to match the color of my windows form with no luck. Control control = statusbar1; control.backcolor =...
3
1571
by: tshad | last post by:
Why doesn't BackColor on a label work (ForeColor works): Dim theAnswer as Label theAnswer.ForeColor = System.Drawing.Color.yellow theAnswer.BackColor = System.Drawing.Color.green BackColor on...
1
1141
by: Matt | last post by:
I'm having a problem when I place ASP:Textbox controls on a form. During design time the control's backcolor is set to white. When I run the project in debug mode or deploy the page to a test web...
4
7876
by: Rob | last post by:
This should be simple..... The default BackColor of a button (if you look at its property) is "Control" its a gray color, but apparently not a color. During a process I set the BackColor of a...
6
2892
by: Dmitry Duginov | last post by:
Hi, I have the following label markup (label is inside FormView): <asp:Label ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready" BackColor='<%#...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.