请教SkinSharp能否在不同视窗设不同皮肤?
本帖最后由 syhsieh 于 2011-9-27 10:54 编辑最近在论坛上搜寻到SkinSharp这套可以改变皮肤的程式
想说可以改变我的应用程式
可是,发现了一个问题
原先是下面这个图
我想在Button里面在新增一个选单
这个选单想要是不同皮肤颜色的
但是
却变成了下面这个图
徒然发现论坛贴子SkinSharp所举例的例子
都没有可以改变单一想要的Form
可否有人可以帮忙呢? 尝试不同窗体加载的时候,重新加载皮肤之类的,在其他语言里面是可以的,AU3的没搞过 我有在图2地方重新加载皮肤,结果是连原先的视窗都变成第2次加载的皮肤
(就是图2这张图)
结论:没用。 把你调用的代码贴出了,有可能是使用方法不正确导致的。 本帖最后由 syhsieh 于 2011-9-27 13:23 编辑
z_SkinSharp_SkinChange 为原来论坛上下载原始码
z_SkinSharp_SkinChange2 为自行修正码(无作用)
z_SkinSharp_Delete 为自行增加, 卸载 handle(有问题,卸载不干净)
z_SkinSharp_DeleteAll 为自行增加, 全部卸载#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$From1 = GUICreate("test1", 200,390)
$Button1 = GUICtrlCreateButton("only work",5,5, 190,50)
$Button2 = GUICtrlCreateButton("B2",5,60, 190,50)
$Button3 = GUICtrlCreateButton("B3",5,115, 190,50)
$Button4 = GUICtrlCreateButton("B4",5,170, 190,50)
$Button5 = GUICtrlCreateButton("B5",5,225, 190,50)
$Button6 = GUICtrlCreateButton("B6",5,280, 190,50)
$Button7 = GUICtrlCreateButton("B7",5,335, 190,50)
z_SkinSharp_SkinChange("中國紅china.she")
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button1
$From2 = GUICreate("test2", 250,170)
$Button21 = GUICtrlCreateButton("Unload $From2",5,5, 240,50)
$Button22 = GUICtrlCreateButton("Unload all From",5,60, 240,50)
$Button23 = GUICtrlCreateButton("Change Skin",5,115, 240,50)
z_SkinSharp_SkinChange2("insomnia.she", $From2)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button21
z_SkinSharp_Delete($From2)
Case $Button22
z_SkinSharp_DeleteAll()
Case $Button23
z_SkinSharp_SkinChange2("itunes.she", $From2)
EndSwitch
WEnd
GUIDelete($From2)
EndSwitch
WEnd
GUIDelete($From1)
Exit
;=======================================
Func z_SkinSharp_SkinChange($Filename_She)
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "mhgd")
;int SkinH_AttachEx(LPCTSTR strSkin, LPCTSTR strPwd) 加载指定路径的皮肤进行换肤
;Public Declare Function SkinH_AttachEx Lib "SkinH_VB6.dll" (ByVal strSkin As String, ByVal strPwd As String) As Long
; strSkin 皮肤文件路径
; strPwd 皮肤密钥
;成功返回0,失败返回非0
DllCall($Dll, "int", "SkinH_SetAero", "int", 1)
;int SkinH_SetAero(HWND hWnd) 设置Vista特效
;Public Declare Function SkinH_SetAero Lib "SkinH_VB6.dll" (ByVal hWnd As Long) As Long
;成功返回0,失败返回非0
EndFunc
Func z_SkinSharp_SkinChange2($Filename_She, $hWnd) ;test
$Dll = DllOpen('Skin.dll')
;DllCall($Dll, "int", "SkinH_LockUpdate", "int", $hWnd, "int", 1) ;unwork
;DllCall($Dll, "int", "SkinH_LockUpdate", "int", _WinAPI_GetCurrentProcessID(), "int", 0) ;unwork
;int SkinH_LockUpdate(HWND hWnd,int nLocked) 用于填充表格或者列表控件数据时,重复绘制滚动条影响执行效率问题
;Public Declare Function SkinH_LockUpdate Lib "SkinH_VB6.dll" (ByVal hWnd As Long, ByVal nLocked As Integer) As Long
;hWnd 指定窗体或控件的句柄
;nLocked 是否锁定。1为锁定,0为解锁
;成功返回0,失败返回非0
DllCall($Dll, "int", "SkinH_SetAero", "int", 1)
;DllCall($Dll, "int", "SkinH_SetAero", "int", 0) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "hwnd", $hWnd) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", $hWnd) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", ControlGetHandle("", "", "")) ;unwork
;DllCall($Dll, "int", "SkinH_SetAero", "int", _WinAPI_GetCurrentProcessID()) ;unwork
MsgBox(0,"", "$hWnd="&$hWnd &@CRLF& _
"Control_GetNowHandle="&ControlGetHandle("", "", "") &@CRLF& _
"_WinAPI_GetCurrentProcessID="&_WinAPI_GetCurrentProcessID())
;DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "mhgd")
;DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She) ;wrong
DllCall($Dll, "int", "SkinH_AttachEx", "str", $Filename_She, "str", "")
EndFunc
Func z_SkinSharp_Delete($hWnd) ;release $hWnd
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_DetachEx", "int", $hWnd) ;release not very clear
;DllCall($Dll, "int", "SkinH_DetachEx", "int", ControlGetHandle("", "", "")) ;release current button
;DllCall($Dll, "int", "SkinH_DetachEx", "int", _WinAPI_GetCurrentProcessID()) ;unwork
EndFunc
Func z_SkinSharp_DeleteAll() ;all release
$Dll = DllOpen('Skin.dll')
DllCall($Dll, "int", "SkinH_Detach") ;OK
EndFunc z_SkinSharp_SkinChange 为原来论坛上下载原始码
z_SkinSharp_SkinChange2 为自行修正码(无作用)
z_SkinS ...
syhsieh 发表于 2011-9-27 13:20 http://www.autoitx.com/images/common/back.gif
把所需要的文件全部打包传上来呀! 都已經在裡面了,還需要啥打包
{:face (382):}
页:
[1]