Home > Uncategorized > Rounded Windows and Blur Sample Code

Rounded Windows and Blur Sample Code

October 22, 2008
RoundedWindow Screenshot

Tonight I saw this distressing tweet from @tsjordan:

#wpf: Window.AllowsTransparency, Background="Transparent", WindowStyle="None" ALL A DIRTY LIE. I NEED ROUNDED WINDOWS!

And I thought, "I know that works.  Let me try it real quick."

So I did and I ended up with this RoundedWindow sample pictured to the right.  Once I busted the dirty lie by having rounded corners and double checking that I could click through the window bounds to application beneath, I took it a step further.

With WPF Effects still firmly on the mind, I thought I’d a BlurEffect to the image so even more transparency could be demonstrated.  I linked the Radius of the Blur Effect to the position of the Window in relation to its  the screen.  If the window is at the top of the screen the Blur is 0, at the bottom its 100.

The end result is pretty interesting as you drag the Window up and down your desktop.  Effects are certainly fun.  The sample also includes code for other tasks like setting the position of the Window and finding its position relative to the screen.

Now, I’m not sure if this will solve Jordan’s problem, but it was a nice little coding break, from my other activities.  PDC is only 5 days away!

%d bloggers like this: