Click here to Skip to main content
Click here to Skip to main content

PngSkin - Per Pixel Forms Skin

, 1 Nov 2007
Rate this:
Please Sign up or sign in to vote.
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:

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)

Share

About the Author


Comments and Discussions

 
GeneralMy vote of 2 PinmemberMember 101455208-Jul-13 5:38 
QuestionDemo program could not run as expected Pinmembersapperjiang27-Dec-11 21:36 
GeneralMy vote of 4 Pinmemberlilbucky7213-Nov-11 17:58 
GeneralMy vote of 1 PinmemberAshutosh Bhawasinka23-Jul-09 22:40 
GeneralRE: Building demos Pinmemberjberenguer20-Oct-08 4:20 
GeneralCenter screen a form ! PinmemberBigbermusa2-May-08 21:13 
GeneralRe: Center screen a form ! Pinmemberkfgoh12-Jul-09 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140821.2 | Last Updated 2 Nov 2007
Article Copyright 2007 by Rajneesh Noonia
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid