How do I draw a smooth blurred-glass effect on a border-less Form? I have tried the code listed on Image Processing for Dummies with C and GDI+ page but I'm sure it's not what I should be using. No amount of playing around with it has yielded any kind of result that is what I'm after.
This is basically what I'm trying to achieve:
I'll assume you are talking about Windows 7 / Vista, and you'd like to achieve the blurry transparent areas that some MS programs have in the same way. For the general case, you do need some image processing which I'm not going to cover.
For the case I mentioned above, you are not supposed to do this yourself - this is sort of re-inventing the wheel. Basically, you can use the window manager to achieve this effect (which is called aero glass) by using the methods described by this article: http://msdn.microsoft.com/en-us/magazine/cc163435.aspx
I currently have only a windows 8 machine (in which they cancelled this blurring and transparency by default) so I don't have a test environment to check this. I'll get to one later this week and set-up a sample code to do this,
Once you are using the desktop window manager, if you want just to blur the top part (like in your image), use DwmExtendFrameIntoClientArea to extend the frame (which is aero blurred by default) into your window. For a custom area, use DwmEnableBlurBehindWindow
So, in case this is really what you are looking for (solution for windows 7 / vista in the same way existing MS programs work), tell me and I'll update with code later. Otherwise, if you are looking for a general solution (not just windows vista / 7), tell me to save me the effort of coding this...
EDIT: Given the fact that you chose to manually make the effect, here is some basic code to get you started
Where does this still have bugs (on my testsuite in Windows 8.1)?
Winform
Using Win API like DwmEnableBlurBehindWindow
Example 1:
Example 2: You can change the brush color (ex: DarkRed) to get nice effects
Thing to note here is that you can pick a region where this applies and you can have more then 1.
Wpf
You can use the same approach.
Wpf has much better support for shaders and you can add effect like blur, but thy are more performance heavy. Also your image is most likely from a program created by WPF and Blend.
If i remember correctly you can not use shaders like blur on solid color brush. Therefor following would not give the same effect. Set background 50% see through (Window properties AllowsTransparency="True" and WindowStyle="None")
Native glass windows
Wpf support has been described here: http://www.paulrohde.com/native-glass-with-wpf/
I got following result with slightly different approach: