|
-
April 14th, 2003, 11:19 PM
#1
How to get the Color endpoints of an Active Title Bar?
I'm writing a bunch of custom controls, and to keep with the style and feel of windows, I want to get the two endpoint colors so that my gradients look correct. Any ideas? And I already know the rgb values for the standard color scheme, that isn't what I need. I need a way to programically get the colors, so if the style changes, my controls will change right along with it. Thanks in advance, and props to anyone who can give me some insight into this problem.
-
April 17th, 2003, 04:37 PM
#2
And the Answer is....
For anyone who cares, I found the answer at http://www.experts-exchange.com/Prog..._11256974.html
Here's a little code snippet that will convert it into a Color that you can use in C#.
//----------------------------------------------------------------------
using System.Runtime.InteropServices;
[DllImport( "user32.dll", EntryPoint = "GetSysColor" )]
internal static extern long GetSysColor(long nIndex);
public static Color GetSystemGradientRightColor()
{
long right = GetSysColor(27);
byte blue = (byte)((right & 0x00ff0000) >> 16);
byte green = (byte)((right & 0x0000ff00) >> 8);
byte red = (byte)(right & 0x000000ff);
return Color.FromArgb(red, green, blue);
}
//----------------------------------------------------------------------
Hope this helps someone else too.
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
|