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

PngSkin - Per Pixel Forms Skin

By , 1 Nov 2007
 
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)

About the Author

Rajneesh Noonia
Software Developer (Senior)
United Kingdom United Kingdom
Member
I am an Techinical Lead working with Seria India Ltd. (Previously Known as Xansa),Noida, India. I have worked with Microsoft Visual Basic 6.0 , SQL Server,COM ,WIN32 API. I have been playing with the .NET Framework since it was in beta but have been using it commercially since late 2004.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionDemo program could not run as expectedmembersapperjiang27 Dec '11 - 21:36 
Thanks for sharing your work .One reminder is that you did not include "PngSkin.ocx" in your demo program which caused a failure in my try to run the demo.exe
GeneralMy vote of 4memberlilbucky7213 Nov '11 - 17:58 
very cool, but somewhat unstable, it will actually skin the whole designer windows of vb6 program, lol. and it doesnt unload the skin when using a button, a duplicate png image is created without controls, and even after stopping the program from debugging, the image somehow stays visible, i must then save and close the vb6 program and reopen for the image to dissapear...
GeneralMy vote of 1memberAshutosh Bhawasinka23 Jul '09 - 22:40 
sample not working
GeneralRE: Building demosmemberjberenguer20 Oct '08 - 4:20 
I can't seem to figure out how to run the 2005 example - I thought I was supposed to register the two dll's in the zip but they wouldn't register.. was the 2005 demo actually built with MS VS 2005 or did you use something else...? Anyway, can you help me get the examples running?
 

Thanks,
 
jb
GeneralCenter screen a form !memberBigbermusa2 May '08 - 21:13 
Hi,
 
How to do center screen a form,not work for startpositon property ?
 
Bigbermusa
GeneralRe: Center screen a form !memberkfgoh12 Jul '09 - 23:03 
Yea, big problemo.. form graphic cannot be centered when the form load. WTF | :WTF:

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

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