Click here to Skip to main content
Email Password   helpLost your password?

Screenshot

Introduction

I Wanted to allow a lot of customization in my new application. Besides changing the background color of glass (see my other articles), i wanted a water ripple option too, and this is what I ended up with.

Background

This article assumes you know how to make forms and event handlers (eg. Mouse Down, Move, Resize) and that you are running Windows Vista with DWM and Glass Enabled.

Using the code

The code is fairly simple to use, simply copy the aqua.vb form into your project. Change the properties of aqua so that it is the same size as your main form. Set the borderstyle to none and check to make sure the size is still right, as changing to None messes up size sometimes. Make your front form (your real application form) have a black backround wherever waterglass should be. Use the included VistaControls Project (not written by me, find the real page for them here) Use the Glass Sheet Function of the libray (like in my sample) and when ran, the application should be like the screenshot above.

            
VistaControls.Dwm.DwmManager.EnableGlassSheet(Me)
        

Thats how simple adding glass is! Please see the VistaControls documentation (link above) or explore the library if you are interested in making only part of the form glassy.

Note: You may need to make you're own, bigger, water image depending on form size.

Interestingly enough, in order to show the Aqua form, the following code must be used:

me.hide
aqua.show
me.show

Aqua for has the following code:

Private Sub aqua_Load(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate(Application.StartupPath & "\water.gif") 'display the water
End Sub

Protected Overrides ReadOnly Property CreateParams() As CreateParams 'Makes it not be in AltTab
Get
Dim cp As CreateParams = MyBase.CreateParams
If Not Me.DesignMode Then cp.ExStyle = cp.ExStyle Or &H80
Return cp
End Get
End Property

Points of Interest

I originally tried to do this with a WinMediaPlayer Control :P Failed terribly. Pictureboxes didn't work either, so this actually uses a web browser control to show the picture!

History/Future

No Edits Yet, May Add fire effects sometime. Other effect I would like to do is streaming webcam image into the glass border. That will be a hard one!

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralDownload links
Chrisblackwell
11:57 1 Jan '09  
The download links don't appear to be working. The one that does work seems to be faulty...
GeneralRedo the formatting...
Dave Kreskowiak
15:50 10 May '08  
Remove the Bold from all the text and this just might get approved.

You might also want to put more explanation into the code and not rely on the user to just "figure it out" by looking at the source code.

A guide to posting questions on CodeProject[^]
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008


AnswerRe: Redo the formatting...
Omnicoder
17:28 10 May '08  
O.O Sorry, I didn't do the bold on purpose. Anyway, I will explain a bit more code in an edit.
GeneralRe: Redo the formatting...
Omnicoder
17:41 10 May '08  
Fixed and added more info. Fire effect soon, and (maybe) a webcam effect...


Last Updated 10 May 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010