Click here to Skip to main content
15,881,791 members
Articles / Desktop Programming / Windows Forms

PngSkin - Per Pixel Forms Skin

Rate me:
Please Sign up or sign in to vote.
2.83/5 (11 votes)
1 Nov 2007CPOL1 min read 69K   6.8K   20   7
PngSkin – ActiveX Control used to apply eye catching skins to Windows Forms with minimal code
Screenshot - Screen.gif

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:

VB.NET
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
GeneralMy vote of 2 Pin
Member 101455208-Jul-13 5:38
Member 101455208-Jul-13 5:38 
QuestionDemo program could not run as expected Pin
sapperjiang27-Dec-11 21:36
sapperjiang27-Dec-11 21:36 
GeneralMy vote of 4 Pin
lilbucky7213-Nov-11 17:58
lilbucky7213-Nov-11 17:58 
GeneralMy vote of 1 Pin
Ashutosh Bhawasinka23-Jul-09 22:40
Ashutosh Bhawasinka23-Jul-09 22:40 
GeneralRE: Building demos Pin
jberenguer20-Oct-08 4:20
jberenguer20-Oct-08 4:20 
GeneralCenter screen a form ! Pin
Bigbermusa2-May-08 21:13
Bigbermusa2-May-08 21:13 
GeneralRe: Center screen a form ! Pin
kfgoh12-Jul-09 23:03
kfgoh12-Jul-09 23:03 

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.