SkinForm 1.20 Readme
CONTENTS
1.Overview
2.What's new
3.Feature
4.Usage
5.Development
6.Example
Overview
Are you bored by Windows95 UI? Do you want to create an application
which has a cool and changeable 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.
Thanks to Andre Inghillieri for his suggestions and improvements.
Thanks to Konrad Swart for his .dcr file.
Thanks to all people who give me a lot of encouragement and
suggestions.
*if you use Delphi 3, please add "{$DEFINE DELPHI3}" as a new line
What's new
New in 1.1
1.Add an OnSkinChanged event
2.Reduce the action of refresh
3.Add functions to manage the information of dispaly area
[DISPLAYINFO]
;Section name of display area
Charset=1
;the charset of display area,default is
Count=1
;the number of display area
1=FILENAME, MS Sans Serif, FALSE, FALSE, 9, 0,
31, 163, Filename
;the defination of one display area: ID, Font Name, Bold, Italic, Size, Color, x, y,
Text
You can use SetCharset(Charset
: TFontCharset) to set to a new charset
SetDisplayText(ID
: string; Text : string) to set a display area with a new text
New in 1.2
1. Add support of trackbar
[TRACKBARINFO]
;Section name of TrackBar
Count=2
;the number of trackbar
1=VOLUME, scrollup.bmp, scrolldown.bmp, 45,
184, 64, H, 50
;the defination of one trackbar: ID, Mouse up birmap, Mouse down birmap,
X position, Y posiyion,lLength, style, initial position
Style; H or V
H - Horizontal V - Vertical
2=TIME, scrollup.bmp, scrolldown.bmp, 33, 175,
80, H, 50
You can use OnMouseMoveNotify
to catch the event of dragging trackbar
GetTrackBarPos(ID : string) : integer; to get the current position of
trackbar
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.