|
-
Mar 8th, 2000, 02:07 AM
#1
Thread Starter
New Member
Could someone help me to change the toolbar color within the application without affecting the system settings.That is if I open a different application I should get back the system colors and vice-versa.
Thanks in advance.
Santosh
-
Mar 9th, 2000, 09:12 PM
#2
Hyperactive Member
Hello chsantosh,
I don't understand exactly what you are meaning.
In my private document library I did found the next information to set or to get color information.
Good luck,
Michelle.
How do I change the colour of the title bar?
You can globally change any Windows 95 desktop colour using the SetSysColors function. It takes three parameters : The number of colour elements to change, The Color object constant that you want to change and the RGB value.
The Declaration for this API function is:
Declare Function SetSysColors Lib "user32" Alias _
"SetSysColors" (ByVal nChanges As Long, lpSysColor As _
Long, lpColorValues As Long) As Long
The Constants are:
Public Const COLOR_SCROLLBAR = 0 'The Scrollbar colour
Public Const COLOR_BACKGROUND = 1 'Colour of the background with no wallpaper
Public Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Public Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Public Const COLOR_MENU = 4 'Menu
Public Const COLOR_WINDOW = 5 'Windows background
Public Const COLOR_WINDOWFRAME = 6 'Window frame
Public Const COLOR_MENUTEXT = 7 'Window Text
Public Const COLOR_WINDOWTEXT = 8 '3D dark shadow (Win95)
Public Const COLOR_CAPTIONTEXT = 9 'Text in window caption
Public Const COLOR_ACTIVEBORDER = 10 'Border of active window
Public Const COLOR_INACTIVEBORDER = 11 'Border of inactive window
Public Const COLOR_APPWORKSPACE = 12 'Background of MDI desktop
Public Const COLOR_HIGHLIGHT = 13 'Selected item background
Public Const COLOR_HIGHLIGHTTEXT = 14 'Selected menu item
Public Const COLOR_BTNFACE = 15 'Button
Public Const COLOR_BTNSHADOW = 16 '3D shading of button
Public Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.
Public Const COLOR_BTNTEXT = 18 'Button text
Public Const COLOR_INACTIVECAPTIONTEXT = 19 'Text of inactive window
Public Const COLOR_BTNHIGHLIGHT = 20 '3D highlight of button
To change the colour of the title bar, or caption, of an active window, you would call the function in this way:
t& = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(255,0,0))
This example would turn the active caption red.
How do I find out the colour of the title bar?
Use the API function GetSysColor. It has only one parameter. This is one of the constants written above that specifies which object you want to retrieve the colour of. The declaration of this function is:
Declare Function GetSysColor Lib "user32" Alias _
"GetSysColor" (ByVal nIndex As Long) As Long
This function will return the RGB value of the object. For example, If you want to find out the colour of the active caption, you would use the following code:
col& = GetSysColor(COLOR_ACTIVECAPTION)
NB: For these two functions to work, you must declare the constants as well as the functions.
-
Mar 10th, 2000, 07:46 AM
#3
Thread Starter
New Member
Thanks Michelle,
Using setsyscolor ,we are actually changing the system settings.Say you called the API and then in the application which would change the titlebar color.Now ,you open another application,say notepad for ex.,the titlebar color of notepad is also changed.(These settings would be retained unless we explicitly change it back to the defaults)
What I want to do is ,change the color within the application without changing the system settings(retain the default settings).
Thank you once again and Have a good weekend.
Santosh
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
|