How can I achieve the same alpha border effect that can be seen in the new Visual Studio 2012 main window using windows forms? Its window seems to glow.
4 Answers
So I am not sure if it is the best method, but if you use Spy++ (32-bit) and you look in the windows, you can see that beneath Visual Studio's main window, you can see 4 "VisualStudioGlowWindow" objects.
I hooked the messages in Spy++, and as you could imagine, the 4 windows represent the 4 glowing borders around the form. Further inspection shows that these 4 "glow windows" implement the WS_EX_LAYERED Extended window style, so the glow itself isn't done in WPF (as far as I can tell.)!
Hopefully this clears some stuff up.

- 39,603
- 20
- 94
- 123

- 186
- 2
- 14
AFAIK you can do it with WPF using a mix of this chrome and a custom WPF border. Not sure if on WinForms you can, given it's limited styling options (compared with WPF). Anyway they are using WPF.
-
@FilipeScur - If you don't use WPF it will be very difficult to duplicate what exists in Visual Studio, there is a reason that even Microsoft, moved to the WPF windows. There is no reason not to move to the current version of the .NET Framework which supports WPF applications. – Security Hound Sep 18 '12 at 14:53
-
well, as I said... right now is not an option, but I do have plans to use it soon.. its just that i cant do it right now... tks. – Filipe Scur Sep 18 '12 at 15:42
-
I've found this question that is similar to mine and I might try it out and see how it performs... http://stackoverflow.com/questions/8793445/windows-7-style-dropshadow-in-borderless-form Anyway, how troublesome is to move to WPF? I mean... we´ve been working with winforms fors ages.. – Filipe Scur Sep 18 '12 at 15:48
-
1@FilipeScur believe me, you won't regret doing it not even for a second. WPF is the best invention since the PC! It isn't that hard, I'll encourage you to start with this walktroughs, I also came from the Winforms world and this help me a lot http://msdn.microsoft.com/en-us/library/ee649089.aspx – Erre Efe Sep 18 '12 at 15:52
-
Tks. @RandolfR-F! I'll give it a shot! =) – Filipe Scur Sep 18 '12 at 16:11
-
You can do this in WinForms, it requires a bit of message processing, C-style. – weaknespase Dec 10 '15 at 21:54
Unless you want to handle drawing the entire form yourself you cannot. Because Visual Studio 2010 and Visual Studio 2012 are written on top of WPF and used Windows not Forms.

- 15,387
- 10
- 45
- 77

- 2,577
- 3
- 25
- 42
-
Suppose I want to handle all the drawing myself on winforms, is there a way?? – Filipe Scur Sep 18 '12 at 14:26
-
Create an alpha blendet form for the shadow and move / resize it with the normal window which is not alpha blendet and contains the border and inner content. – Ray Mar 11 '14 at 22:06
Visual Studio 2012 draw its window border using native Win32 functions. It is not related to the WPF or WindowsForms -- you can do it with both.
The glow is rendered on a transparent window on top of the main window. The main window calls the DWM API to set the glass area to 0. This way you can draw over the original border and the system buttons. This is the correct way to do this.
You can look at code of WPF Shell (http://archive.msdn.microsoft.com/WPFShell) to see how the calls to DWM are made in order to remove the glass. The fact that its written to be compatible with WPF doesnt matter, because all you need is a handle (IntPtr) to the window.
If you have a WindowsForms codebase, don't migrate to WPF. WPF has not been improved in the latest .NET framework release and there are no roadmaps to improvements or new features as its team has been integrated into Windows 8 team.

- 1,028
- 7
- 15
-
1If you minimize the Visual Studio 2012 main window and look at it using the taskbar preview (put your mouse over the icon on task bar and then put the mouse over the window thumbnail). There's no glow on the window, because it's rendered on a different window. – Diego Frata Jan 04 '13 at 18:30