Make your application skinable
Component Download: http://www.qwerks.com/download.asp?ProductID=2447
SkinForm is a component to help you make non-rectangle and skinable form,
just like the popular applications such as WinAMP, WPlay ...,
what took hours before can now be done in minutes! With the WYSIWYG
skin builder, you can make the script file quite easy. The component makes
it very easy to create a very complex and skinable form without any programming,
what you have to do is to create several pictures and drag your mouse to set
hot areas to place buttons, texts and track bars. There is even a preview at
design time!
The following features are available:
a.support bmp and jpeg files
b.support graphic button, including switch-style button, radio button
c.support text, graphic text and number
d.support graphic track bar
e.support multi skins, you can give a skin to each form of the application
f.support internal skins, skins can be stored in the resource file
It is very easy to create a skinable project:
- Make bitmap files for a skin
- Use Skin Builder to make a describe file
- Create a new project.
- Place a TSkinForm component on the form
- Compile it
Here is a script file made by SkinBuilder:
[VERSION]
Ver=210 // Version of skin description file
[BITMAPINFO]
MaskBitmap=PlayerMask.bmp
// Bitmap file of the mask, the shape of the form
MouseUpBitmap=PlayerMain.jpg
// Bitmap file of the form when mouse button is up
MouseDownBitmap=PlayerSel.jpg
// Bitmap file of the form when mouse button is down
MouseOnBitmap=PlayerSel.jpg
// Bitmap file of the form when mouse currsor is over [optional]
NumbersBitmap=
// Bitmap file of the graphic number [optional]
TextBitmap=
// Bitmap file of the graphic text [optional]
[HOTAREAINFO]
Count=19 // The total number of buttons
// Description of one button
// number=ID, top, left, width, height, hint [, button state, group name]
// Description in the [ ] is optional
1=BUTTON_PLAY, 54, 165, 34, 35, Play/Pause
2=BUTTON_STOP, 129, 165, 19, 35, Stop
3=BUTTON_NEXT, 90, 165, 18, 17, Next
4=BUTTON_PREV, 109, 165, 18, 17, Previous
...
[DISPLAYINFO]
Charset=1 // Charset of the text area
Count=3 // The total number of text areas
// Description if one text area
// number=ID, font name, bold, italic, size, color, top, left, style, default text, hint, width, height
1=TEXT_LEN, Arial, TRUE, FALSE, 9, $00366835, 116, 137, Normal, [00:00], Length, 51, 18
2=TEXT_POS, Arial, TRUE, FALSE, 12, $00366835, 55, 133, Normal, 00:00, Position, 52, 23
3=TEXT_SONG, MS Sans Serif, FALSE, FALSE, 7, $00366835, 56, 112, Normal, Song Name, Song Name, 111, 21
[TRACKBARINFO]
Count=2 // The total number of track bars
// Description if one track bar
// number=ID, trackbar bitmap file, trackbar bitmap file, top, left, length, style, position, hint
1=TRACKBAR_VOLUME, TrackBar.BMP, TrackBar.BMP, 79, 205, 88, H, 65, Volume
2=TRACKBAR_POS, TrackBar.BMP, TrackBar.BMP, 79, 217, 88, H, 0, Time
Yes, without any code, the application is skinable.
you can add you code to catch event of MouseUp, Down, Over ...
The following is sample code:
...
procedure TForm1.FormCreate(Sender: TObject);
begin
//Load a skin file
SkinForm1.LoadDefaultSkin;
SkinForm1.SetDisplayText('VOLUME', IntToStr(SkinForm1.GetTrackBarPos('TRACKBAR_VOLUME')));
SkinForm1.SetDisplayText('TIME', IntToStr(SkinForm1.GetTrackBarPos('TRACKBAR_POS')));
SkinForm1.SetTrackBarMinMax('TRACKBAR_VOLUME', 20, 80);
end;
procedure TForm1.SkinForm1MouseUpNotify(ID: String; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
pos : TPoint;
begin
if (Button = mbLeft) then
begin
if ID = 'BUTTON_EXIT' then
Close;
if ID = 'BUTTON_MINIMIZE' then
Form1.Perform(WM_SYSCOMMAND, SC_MINIMIZE, 0);
if ID = 'BUTTON_MENU' then
begin
pos := ClientToScreen(Point(X, Y));
PopupMenu1.Popup(pos.x, pos.y);
end;
end;
if (Button = mbRight) then
begin
pos := ClientToScreen(Point(X, Y));
PopupMenu1.Popup(pos.x, pos.y);
end;
...