Friday, July 16, 2010

Translucency and Transparency Effects in Windows Applications

Transparency is a feature in .NET that can make your applications with that Vista/Windows 7 feel. This simple code excerpt lets you adjust the Opacity on the Form with only marginal resource consumption with a Timer Control.


public string upOrDown = "down";

private void tmrOp_Tick
(object sender, EventArgs e)
        {
            if (upOrDown == "down")
            {
                this.Opacity = this.Opacity - 0.01;
            }
            else
            {
                this.Opacity = this.Opacity + 0.01;
            }


            if (this.Opacity < 0.81)
            {
                upOrDown = "up";
            }
            if (this.Opacity > 0.99)
            {
                upOrDown = "down";
            }
        }

No comments:

Post a Comment

Generating "Always On Top" NSWindow in macOS across all detected displays

Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift  Langues, you m...