如何制作可以换肤的窗体(200点)(200分)

  • 主题发起人 主题发起人 一辉
  • 开始时间 开始时间

一辉

Unregistered / Unconfirmed
GUEST, unregistred user!
如何使自己的From具有想Winamp,超级解霸具有换肤功能
My Email: supersite@china.com
 
到深度历险上找一个控件即可。那里有分类,很好找。
 
最好先找一个控件,看看源码,弄明白原理,再做。
 
据说有一个叫Active Skin的OCX很不错,谁有?
 
都找控件...这样,水平什么时候才能提高啊? 还是 MMX 的做法好,在理解的基础上
抄(??好象是上学时老师的话啊..)
 
如果你有时间,当然是研究明白最好,,,,
 
如果说的是超级解霸中换底纹(含构件)的问题,所有提供
底纹的控件均可动态更换,似乎没多少困难,如果是其他,
请更详细说明。
 
可是谁能告诉我控件具体的URl地址,价值200分
 
我使用背景贴图,用Inf记载背景文件名称
简单,有效
 
深度历险上有,我下载过
 
深度历险上去找找吧,好东东挺多!
 
>我使用背景贴图,用Inf记载背景文件名称
slfeng,这个如何实现?
 
1stclass2000pro和activeskinv3。52都是很好的界面控件
 
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.

 
后退
顶部