|
-
Oct 13th, 2003, 10:52 AM
#1
Thread Starter
Member
Change the background color of a StatusBar [RESOLVED]
The C# status bar does not have a BackgroundColor property or anything similar.
How can I go about changing it's colour?
My forms are all light blue but the dastardly status bar is still grey!
Maybe an API call?
Last edited by Genie; Oct 14th, 2003 at 06:26 AM.
-
Oct 13th, 2003, 12:41 PM
#2
Addicted Member
Use the SendMessage API
Code:
[DllImport("user32.dll")]
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
SendMessage sBar.hwnd, SB_SETBKCOLOR, 0, NewBgColor
I'm not sure the value of SB_SETBKCOLOR you will have to look it up
-
Oct 14th, 2003, 06:25 AM
#3
Thread Starter
Member
Thanks you very much Tewl.
For others who also need to know how to change the colour of the status bar:
Add reference:
using System.Runtime.InteropServices;
the value for SB_SETBKCOLOR:
int CCM_FIRST = 0x2000;
SB_SETBKCOLOR = (CCM_FIRST + 1);
-
Oct 10th, 2006, 03:17 AM
#4
New Member
Re: Change the background color of a StatusBar [RESOLVED]
hi,
thanks for the code. But I have a problem. In design view it works correct. but when I am running the application, its not working.
my status bar is inside a user control. Can anybody help me ??
Regards,
Reshmi
-
Oct 10th, 2006, 09:23 AM
#5
Re: Change the background color of a StatusBar [RESOLVED]
 Originally Posted by Reshmi
hi,
thanks for the code. But I have a problem. In design view it works correct. but when I am running the application, its not working.
my status bar is inside a user control. Can anybody help me ??
Regards,
Reshmi
Within the Usercontrol, make the access specifier of Statusbar Public, then use the SendMessage API like
Code:
SendMessage UserControlName.ProgressBarName.Handle, SB_SETBKCOLOR, 0, NewBgColor
[Handle] is in C# as [Hwnd] is in VB.
EDIT: Oh, I forgot to add, this is an old thread, so if you have similar question/s, make a seperate/your own thread because it's unlikely that people will open a *RESOLVED* thread.
Last edited by Harsh Gupta; Oct 10th, 2006 at 03:09 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|