Introduction
PngSkin is an ActiveX control written in Vb6 that can be used to apply per pixel alpha transparent PNG skin to any application (VB6 and .NET). You can ask your designer (Corel Draw) to create eye catching designs for your application. The control can be used for win2000 and upper operation systems. The non client area of any window can be designed in professional drawing software.
The best part of this control is that to use it in your application you need not code or configure it heavily. For VB6 Windows application, you need not write even a single line of code. For .NET Windows forms, you need to write just 2 lines of codes.
The Activex Control uses updatelayeredwindow
(ULW) and setlayeredwindowattributes
(SLWA) APIs to create a semi-transparent form capable of "hosting" controls. The word "hosting" is not correct. This example shows one way of creating a host form for controls and overlaying it on the semitransparent background.
Using the Code
For VB 6 Windows Forms
Add the component to your project and drag & drop to your form. Set form border to None and add some background colour.
Set the property ImageOuterPath = "your Png File Path"
and run the project.
For .NET Windows Forms
Repeat the above procedure and add the following code to your Winform:
Private Sub PictureBox1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles PictureBox1.Click
AxSkin1.UnloadSkin()
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackgroundImage = Nothing
With AxSkin1
.ActivateSkin(Me.Handle.ToInt32)
End With
End Sub
Points of Interest
To map the controls in design time, the control will set the background of form to PNG automatically in VB 6, however you need to set the forms background image to your PNG file.
Thanks
Many many thanks to LaVolpe for sharing the PNG support in VB 6 [http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=68527&lngWId=1].
History
- 2nd November, 2007: Initial post