tags:

views:

461

answers:

3

using c# how do you programmatically change the windows border color when running aero on windows 7?

+1  A: 

It is not possible to change the color of a window individually but you can change the color OS-wide via the resgistry. The entry should be something like this: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Glass Colorization\Swatches in conjunction with HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM - ColorizationColor

From within your code you can only adjust the shape and the size of your Glass border but I don't think the color. In Windows Forms it is done like this and in WPF like this.

bitbonk
how do you change the color using the reg keys? do you any sample code ? :D on how to implement this? :D
TheCardinal
+2  A: 

This isn't possible with C#/.NET. WPF/WindowsForms only allow you to change the borders on elements inside the application. Application borders are user-controlled.

George
A: 

While bitbonk and george have correctly pointed out that windows is not capable of changing the border colors for individual windows, you might look into owner-drawing the window. You may then be able to achieve what you need, however, the window will most probably not look like a "native" window anymore.

See this question on SO.

Thorsten Dittmar