SIGN UP MEMBER LOGIN:    
ARTICLE

A Shaped Windows Forms Application with Variable Opacity

Posted by Robert Hinrichs Articles | Windows Forms C# March 11, 2002
This application demonstrates two simple techniques that beginners might find useful in developing creative new looks for Windows applications.
Reader Level:
Download Files:
 

This application demonstrates two simple techniques that beginners might find useful in developing creative new looks for Windows applications.

The first technique is that of a shaped Windows form and is an implementation of a Microsoft article: (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html
/vbtchshapedwindowsformscontrolsinvisualstudionet.asp
)

The second technique is also from Microsoft. I saw it in a Webcast entitled "Debugging .NET Applications with Visual Studio .NET" by Shaykat Chaudhuri. He demonstrated a transparent Windows Forms timer application. Using this application, he showed how he was able to time his presentations for proper length while viewing through the transparent timer at his Power Point cells. I was impressed. I don't know if the source code is available for this demo, but it turns out this technique very simple to achieve in Visual Studio .NET.

I've combined these two simple concepts in the attached demo. The demo is written in C# and Windows Forms and was tested in Windows 2000 using VS Ver. 7.0.9466 and the .NET Framework Ver. 1.0.3705.

Shown below, is a clock application running on the desktop in its transparent mode. The app can be dragged and positioned with the left mouse button while transparent.

The right mouse button brings up a context menu with various settings and an exit item ( providing basic title bar functionality ). It also brings up the opacity factor in steps as the application "un-cloaks" for use. When a menu item is selected, the application "fades-out" back to the transparent mode (or terminates).



The application included (winShapeSevenSegmentLED.exe) uses the seven segment "retro" digital clock in Charles Petzold's book "Programming Microsoft Windows with C#" ISBN: 0-7356-1370-2. I didn't include the source code as it is copyrighted but if you have the book you can uncomment the #define, add his SevenSegmentClock class to the project, and recreate the application shown above. Without this code, only the basic shaped form, menu items and opacity functionality is provided.

Using uncommonly shaped and transparent objects might make an interesting desktop for a child. She would be able to see all running applications at once and in fun compelling shapes.

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor