1.引用Dll皮肤文件
Type
procedure SetSkin(skinnam:string);
procedure TFrmMain.SetSkin(skinnam:string);
var
Hinst:THANDLE;
RStream:TResourceStream;
begin
Hinst:=Loadlibrary('ALLSK.dll');
If Hinst=0 Then
Exit
else
begin
Rstream:=TResourceStream.Create(Hinst,skinnam,'MYSKIN');
dxSkinsUserSkinLoadFromStream(Rstream);
dxSkinController1.NativeStyle:=False;
dxSkinController1.UseSkins:=True;
end;
end;
procedure TFrmMain.Button1Click(Sender: TObject);
begin
setskin('Office2007Blue');
end;
2.有效减小使用皮肤后软件体积巨大的方法:
一. DELPHI的主菜单: Project -> Modify Skin Options ,弹出Project Skin Options
Editor 对话框,从列表中,只选择: UserSkin这一项,取消Enable skin Support的勾,
点OK退出. (注意:此步骤需DEV40以上版本才有效)
二. 从Dev Express 项下选择dxSkinController控件,添加到工程,设置dxSkinController1的SkinName属性设为:UserSkin ;
三. 代码:(对RES皮肤有效,在程序文件夹里需要先建一个叫Skin的文件夹)
procedure TFrmMain.Button1Click(Sender: TObject);
var str:string;
begin
str:='Xmas2008Blue.skinres'; //可自行修改
dxSkinsUserSkinLoadFromFile(Trim(ExtractFilePath(Application.ExeName)) + '\skin\' + str);
dxSkinController1.NativeStyle:=False;
dxSkinController1.UseSkins:=True;
end;