Click here to Skip to main content
13,352,298 members (59,813 online)
Click here to Skip to main content
Add your own
alternative version


60 bookmarked
Posted 4 Mar 2005

Floating, collapsible transparent window in C#

, 4 Mar 2005
Rate this:
Please Sign up or sign in to vote.
How to create a floating, collapsible transparent form in C# using the NativeWindow class

Demo image


Working with Windows Forms is wonderful and all the features offered by the framework and Visual Studio make working so enjoyable. But every now and then it comes a time in the life of a programmer when he needs a challenge. This happened to me a few months ago when I was working on some user control and I thought it would be really nice if at design-time I would be able to present the user with a context menu much more appropiate then the one included in Visual Studio. So, the idea of a window that can be popped up on the screen emerged and this is how the floating native window came to be.

Using the code

The code is very straightforward. There is a

class declared inside the Olvio.FloatingWindow.dll library and the solution also includes a Test that demonstrates the tool.

This is the code used to show the window:

private void button1_Click(object sender, System.EventArgs e) 
 Olvio.Windows.Forms.AnimateMode anim = (Olvio.Windows.Forms.AnimateMode)
                                   this.comboBox1.Text, true); 
 fw.ShowAnimate(fw.Location.X, fw.Location.Y, anim);

As you can see the FloatingWindow can be shown with one of the 10 animation modes:

public enum AnimateMode 
  RollTopToBottom, RollBottmToTop, 

The test project actually creates an inherited FloatingWindow to demonstrate the ability to do custom drawing by overriding the PerformPaint method. 

Also, the demo shows how you can modify the alpha-blend propertie at run-time. For this purpose the test project displays a NumericUpDown control.

The window also displays a caption bar, a semi-transparent shadow, a minimize/maximize button and a close button. Also, the window can be resized using the resize grip in the bottom-right corner.


Version 1.0 - First version.
Known bugs:

  • Hiding with animation produces a strange flicker


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
Iulian Ionescu is the founder and owner of Olvio IT Inc, a NY based software company geared towards .Net programming. Iulian has been involved in programming since early 1989 and his first passion was Turbo Pascal. The passion then moved to Assembly, C++, Win32 Assembly and finally C#. Check out more on the company website:

You may also be interested in...

Comments and Discussions

Generalgood for x86 only app, but incompatible with x64 Pin
TommyB85-Jan-09 14:53
memberTommyB85-Jan-09 14:53 
GeneralAdding control to it (e.g. Datagridview) Pin
abbyjeet27-Aug-07 17:41
memberabbyjeet27-Aug-07 17:41 
GeneralError while repeting show / hide Pin
grincheux_uk27-Mar-07 4:48
membergrincheux_uk27-Mar-07 4:48 

I use this control in an winform application running on XP SP2.
Its purpuse is to implement a zoom on images. A same instance is used many times.

After a certain number of ShowAnimate / HideAnimate actions (25, 30 times), the method AnimateWindow returns error code ERROR_PROC_NOT_FOUND=127 and NOT_ENOUGH_MEMORY=8.

Any idea of the reason?

QuestionCan it be made to work with.. Pin
grep224-Aug-06 22:26
membergrep224-Aug-06 22:26 
GeneralCustomizing the floating window Pin
ilanb19-Jul-06 11:51
memberilanb19-Jul-06 11:51 
GeneralMemory Leak Found Pin
lgoolsby24-Aug-05 11:14
memberlgoolsby24-Aug-05 11:14 
GeneralOut of memory exception Pin
hungpvtn17-Jun-05 19:07
memberhungpvtn17-Jun-05 19:07 
GeneralRe: Out of memory exception Pin
lgoolsby24-Aug-05 10:43
memberlgoolsby24-Aug-05 10:43 
GeneralRe: Out of memory exception Pin
zuken2112-Jan-06 21:51
memberzuken2112-Jan-06 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 4 Mar 2005
Article Copyright 2005 by Julusian
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid