SkinForm Readme
CONTENTS
1.Overview
2.Feature
3.Usage
4.Development
5.Example
Overview
Are you bored by Windows95 UI? Do you wanted to create an application which has a cool and custom UI just like WPlay and WinAmp?
If so, SkinForm might be the thing that you want. This component can help you to change the visual appearance of your project and make non-rectangular
windows forms quite easily.The only thing you need do is to create your bitmap files and a description file for a skin.
This component can be freely used and distributed in commercial and private products, if you like it, please drop me an e-mail and send your screenshots.
Please feel free to contact me if you have any comments or suggestions.
Author: Xue Huai Qing
xhq@writeme.com
The newest version can be downloaded from my homepage http://friendsoft.yeah.net
Some functions come from Jscalco & Eddie Shipman, many thanks to them.
*if you use Delphi 3, please add "{$DEFINE DELPHI3}" as a new line
Feature
The ability to change the visual apperance of the application.
Support of windows of the nonrectangular form.
Support the switch-style button such as the Shuffle, Repeat button in a CD Player.
...
Usage
1.Make the skins of your applications, they are must be in bitmap format.
2.Make a skin file just like the skin file in the demo.The file format is described in the readme file.
3.Use LoadSkinFile to load a skin file.
4.Add your own code to catch the following events:OnMouseDownNotify, OnMouseMoveNotify, OnMouseUpNotify
Development
All files of one skin should be placed in one directory.
These files consist of the following types:
skin.ini - main file containing the description of a skin.
*.bmp bitmap pictures for the skin.
The format of skin.ini:
[BITMAPINFO] ; Section name of bitmap file
MaskBitmap=mainmask.bmp ; filename of the mask bitmap
MouseUpBitmap=main.bmp ; filename of the mask bitmap
MouseDownBitmap=selected.bmp ; filename of the mask bitmap
MouseOnBimap=selected.bmp ; filename of the mask bitmap
[HOTAREAINFO] ; Section name of hot area
Count=11 ; the number of hot area
1=BUTTON_PLAY, 29, 249, 26, 18 ; the infomation of one hot area, ID, x , y, width, height, initial state if it is a switch-style button.
...
9=BUTTON_MENU, 31, 215, 27, 23
10=BUTTON_REPEAT, 99, 293, 24, 17, FALSE
11=BUTTON_SHUFFLE, 60, 293, 30, 18, FALSE
You can still use all standard events of TImage, because TSkinForm is derived from TImage. But I think it is better to catch the mouse events by using OnMouseXXXXNotify evens instead of the stardard mouse events.
Use the LoadSkinFile procedure to load a skin.
Use the OnMouseDownNotify, OnMouseDownNotify,OnMouseDownNotify to catch the mouse event.
Use the ID in the event hadle to indentify which button was pressed.
Use the GetHotAreaState function to know if the switch-style button was on or off.
Example
SkinTest is a very simple application written in Delphi that demonstrates how to uses the TSkinForm. SkinTest has three different skins, they come from the skins of WPlay - Another wonderful MP3 Player.
Step A:
Create your bitmap files of skins, the opacity bitmap for creating windows region, the bitmaps of inactive, mouseon and mousedown state.In this sample, we used the skins of WPlay.
Step B:
Create the skin.ini files for your skins just like the following:
[BITMAPINFO]
MaskBitmap=mainmask.bmp
MouseUpBitmap=main.bmp
MouseDownBitmap=selected.bmp
MouseOnBimap=selected.bmp
[HOTAREAINFO]
Count=9
1=BUTTON_PLAY, 29, 249, 26, 18
2=BUTTON_STOP, 92, 246, 28, 20
3=BUTTON_PAUSE, 60, 271, 29, 16
4=BUTTON_PREV, 60, 220, 26, 17
5=BUTTON_NEXT, 60, 237, 28, 17
6=BUTTON_EJECT, 25, 318, 25, 17
7=BUTTON_MINIMIZE, 24, 340, 24, 16
8=BUTTON_EXIT, 101, 68, 19, 25
9=BUTTON_MENU, 31, 215, 27, 23
10=BUTTON_REPEAT, 99, 293, 24, 17, FALSE
11=BUTTON_SHUFFLE, 60, 293, 30, 18, FALSE
Step C:
Create a new project in Delphi IDE and place a TSkinForm component on the form.Then double click the form to add the FormCreate procedure and add the following code to load a skin file:
SkinForm1.LoadSkinFile('./skins/default/skin.ini');
Step D:
Add code to the OnMouseUpNotify event to handle the the mouse action. See the source code of demo for the details.