Custom Controls - Custom Panel with Opacity

From Visual WebGui Wiki

Jump to: navigation, search



Contents

Overview

This is an implementation of a Custom Panel control, OpacityPanel, as a Visual WebGui 6.4 Custom Control that has adjustable Opacity (transparency) setting. The control also has adjustable setting for if you want to apply the Opacity on child controls or not.

To use simply add the OpacityPanel Panel control on a Form and adjust the Opacity and OpacityOnChildren properties to your liking.

The attached demo application has code for C# and VB.NET in VS2005 and VS2008. The application is written for Visual WebGui version 6.4.0Beta2 and does not work for earlier versions.

Samples of use

VB.NET Code

Public Property Opacity() As OpacityValue
    Get
        Return mobjOpacity
    End Get
    Set(ByVal value As OpacityValue)
        mobjOpacity = value
    End Set
End Property

C# Code

public  OpacityValue Opacity
{
    get
    {
        return mobjOpacity;
    }
    set
    {
        mobjOpacity = value;
    }
}

The demo application

Opacity Panel Control Demo application

Tips and Tricks

Two extra public properties are defined on the custom OpacityPanel control. The use of the Opacity property deserves special attention, as it is declared as an OpacityValue type, which is an internal type of Visual WebGui. This type of usage is a great helper when it comes to the XSLT, as the value returned within the XSLT will actually be a browser dependent style setting for Opacity (the syntax is different betwen IE and FF for instance), so we do not need any browser type specific resources when using this method.

SDK Version highlights

The demo application is written against Visual WebGui version 6.4.0Beta2 and will not work on a pre 6.4 versions.

Personal tools