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 Pin
Chrisblackwell
11:57 1 Jan '09  
GeneralRedo the formatting... Pin
Dave Kreskowiak
15:50 10 May '08  
AnswerRe: Redo the formatting... Pin
Omnicoder
17:28 10 May '08  
GeneralRe: Redo the formatting... Pin
Omnicoder
17:41 10 May '08  


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