riverar / sample-win10-aeroglass

Sample WPF Aero Glass-like blur app (deprecated)
https://withinrafael.com/2015/07/08/adding-the-aero-glass-blur-to-your-windows-10-apps/
MIT License
89 stars 16 forks source link

How to implement this in WinForm C#(Not WPF) #3

Open rikka0w0 opened 8 years ago

rikka0w0 commented 8 years ago

default I'm trying to implement this in C#, I simply replaced the handle of a WPF window with my WinForm, the blur can appear, but all those control texts becomes transparent.

Will there be any solution for this?

riverar commented 8 years ago

Change the TransparencyKey on the form to, say, Colors.Fuchsia and should resolve that.

rikka0w0 commented 8 years ago

@riverar I have solved this by setting the TransparencyKey to a rarely used color on my WinForm, but another problem arised. I tried to draw a semi-transparent ellipse on my form, with the color of the TransparencyKey and alpha is set to 50%, but I get a solid shape instead of a semi-transparent one. Can you help me with this problem? Thanks so much~

MarceSosa22 commented 3 years ago

Muestra1

hi i dont speak english but i will try.

I implemented in visual basic.net C #, I get the result of the image, is there a way to apply the blur only to a panel? or leave the blur in a certain area of ​​the form?

MarceSosa22 commented 3 years ago

I clarify, the transparentkey of the form only accepts black color, it does not apply the blur with another color. my problem is the text boxes, the rest is tolerable. As you can see in the previous image, the text box is lost with the white background.

riverar commented 3 years ago

@marcesosa22 This composition trick does not support child hwnds (so you can't pass in a panel handle). Instead, you can set the Panel background color to Fuschia, then set the Form's TransparencyKey to Fushcia.

This: image

Produces: image

riverar commented 3 years ago

@rikka0w0

https://user-images.githubusercontent.com/475132/104390709-2afde300-54f3-11eb-8a47-8c895993a6c5.mp4

You can fiddle with the opacity via GradientColor, you can't do this at the winforms level. https://github.com/riverar/sample-win32-acrylicblur/blob/master/MainWindow.xaml.cs#L74