SkinSharp GUI skins for ahkv2

Post your working scripts, libraries and tools.
sashaatx
Posts: 351
Joined: 27 May 2021, 08:27
Contact:

SkinSharp GUI skins for ahkv2

Post by sashaatx » 18 Apr 2023, 12:08

credit to the creators:
http://www.skinsharp.com/htdocs/docs.htm,
https://github.com/CodyGuo/skinh

complete v2 code found here: https://github.com/samfisherirl/skinshe.ahk
Best thread on the topic Im aware of: viewtopic.php?t=5841

I know when I first used this 5 years ago this got virus flagged, if someone knows some voodoo reverse engineering obscurification of (I assume) C++ let me know. Or a cleaner skin handler DLL.

Optional include method:
#Include skins\skins.ahk
setTheme("darkroyale.she")

Include file:

Code: Select all


; 强制使用32位运行
if !(1 = 1 and A_PtrSize = 4)
{
	Run(A_ScriptDir "\skins\AutoHotkeyU32.exe `"" A_ScriptFullPath "`"") ;Must run 32bit
	; Run either 32bit AHKV2
	ExitApp()
}
setTheme(theme := "aero.she"){
	hSkinH := DllCall("LoadLibrary", "Str", "skins\SkinHu.dll")
	changeSkin(A_ScriptDir "\skins\" theme)
}
changeSkin(skinPath) {
	DllCall("SkinHu\SkinH_AttachEx", "Str", skinPath, "Str", "mhgd")
}

Browser pictured below:

Code: Select all

; Dll文件在此下载 https://github.com/CodyGuo/skinh
; 官方说明与皮肤文件 http://www.skinsharp.com/htdocs/docs.htm

#SingleInstance Force

; 强制使用32位运行
if !(1 = 1 and A_PtrSize = 4)
{
	Run(A_ScriptDir "\AutoHotkeyU32.exe `"" A_ScriptFullPath "`"") ;Must run 32bit
	; Run either 32bit AHKV2
	ExitApp()
}


hSkinH := DllCall("LoadLibrary", "Str", "SkinHu.dll")
changeSkin(A_ScriptDir "\skins\aero.she")

changeSkin(skinPath) {
	DllCall("SkinHu\SkinH_AttachEx", "Str", skinPath, "Str", "mhgd")
}


; ███████╗██╗  ██╗██╗███╗   ██╗███████╗██╗  ██╗ █████╗ ██████╗ ██████╗ 
; ██╔════╝██║ ██╔╝██║████╗  ██║██╔════╝██║  ██║██╔══██╗██╔══██╗██╔══██╗
; ███████╗█████╔╝ ██║██╔██╗ ██║███████╗███████║███████║██████╔╝██████╔╝
; ╚════██║██╔═██╗ ██║██║╚██╗██║╚════██║██╔══██║██╔══██║██╔══██╗██╔═══╝ 
; ███████║██║  ██╗██║██║ ╚████║███████║██║  ██║██║  ██║██║  ██║██║     
; ╚══════╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     

FileMenu := Menu()
FileMenu.Add("test1", MenuHandler)
FileMenu.Add("test2", MenuHandler)
FileMenu.Add("test3", MenuHandler)
FileMenu.Add("test4", MenuHandler)
FileMenu.Add("test5", MenuHandler)
FileMenu.Add("test6", MenuHandler)
MenBar := Menu()
MenBar.Add("&File", FileMenu)
MenBar.Add("&Test", testMenu)
myGui := Gui()
myGui.OnEvent("Close", GuiEscape)
myGui.OnEvent("Escape", GuiEscape)
myGui.MenBar := MenBar
ContextMen := Menu()
ContextMen.Add("&Open...`tCtrl+O", MenuHandler)
ContextMen.Add("&Save`tCtrl+S", MenuHandler)

; 显示皮肤文件
myGui.Add("GroupBox", "x24 y8 w248 h650", "控件演示")
ogcListViewlv := myGui.Add("ListView", "x40 y40 w215 h586  vlv AltSubmit", ["皮肤"])
ogcListViewlv.OnEvent("Click", change)
Loop Files, "skins\*.she"																	; 从文件夹中获取文件名列表并把它们放入 ListView:
	ogcListViewlv.Add("", A_LoopFileName)
ogcListViewlv.ModifyCol()																		; 根据内容自动调整每列的大小.

; 下面全是右侧演示控件
Tab := myGui.Add("Tab3", "x288 y8 w495 h650", ["Tab 1", "Tab 2"])

myGui.Add("Text", "x336 y45 w96 h24", "Some Text")
myGui.Add("Link", "x472 y45 w96 h24", "<a href=`"https://autohotkey.com`">autohotkey.com</a>")
myGui.Add("ComboBox", "x608 y40 w120", ["combobox"])

myGui.Add("Checkbox", "x336 y80 w96 h24", "checkbox")
myGui.Add("Radio", "x472 y80 w96 h24", "radiobutton")
myGui.Add("DropDownList", "x608 y80 w120", ["DropDownList", "123", "456"])

myGui.Add("Edit", "x336 y120 w96 h24", "edit")
myGui.Add("UpDown", "x432 y120 w17 h24 -16", "1")
myGui.Add("Hotkey", "x608 y120 w120 h20")

myGui.Add("Progress", "x336 y160 w233 h24", "50")
myGui.Add("Slider", "x336 y200 w233 h24", "50")
ogcButton := myGui.Add("Button", "x608 y160 w120 h65", "Get code template")

ogcListViewRedGreen := myGui.Add("ListView", "x336 y240 w120 h148", ["Red", "Green", ""])
ogcListViewRedGreen.OnEvent("DoubleClick", change)
myGui.Add("ListBox", "x472 y240 w120 h148", ["Red", "Green", "Blue", "Black", "White"])
ogcTreeView := myGui.Add("TreeView", "x608 y240 w120 h148")
P1 := ogcTreeView.Add("First parent")
P1C1 := ogcTreeView.Add("Parent 1's first child", P1)  ; 指定 P1 为此项目的父项目.
P2 := ogcTreeView.Add("Second parent")
P2C1 := ogcTreeView.Add("Parent 2's first child", P2)
P2C2 := ogcTreeView.Add("Parent 2's second child", P2)
P2C2C1 := ogcTreeView.Add("Child 2's first child", P2C2)

myGui.Add("Text", "x336 y408 w398 h2 +0x10")

myGui.Add("DateTime", "x336 y424 w225 h20", "2021-01-29")
myGui.Add("MonthCal", "x336 y448 w225 h176")
SB := myGui.Add("StatusBar", , "Status Bar")

	; 设置换肤里的 LV_GetText() 函数默认操作第一个 ListView
myGui.Title := "myTitle"
myGui.Show("w805 h694")
Return

change(ogcListViewRedGreen, RowNumber)
{ ; V1toV2: Added bracket
	OutputVar := ogcListViewRedGreen.GetText(RowNumber)
	hSkinH := DllCall("LoadLibrary", "Str", "SkinHu.dll")

	DllCall("SkinHu\SkinH_AttachEx", "Str", A_ScriptDir "\skins\" OutputVar, "Str", "mhgd")
	Return
} ; V1toV2: Added bracket before function

MenuHandler(A_ThisMenuItem, A_ThisMenuItemPos, MyMenu)
{ ; V1toV2: Added bracket
	Return
} ; V1toV2: Added Bracket before label
testMenu(A_ThisMenuItem, A_ThisMenuItemPos, MyMenu)
{ ; V1toV2: Added bracket
	Return
} ; V1toV2: Added Bracket before label

GuiEscape(*)
{ ; V1toV2: Added bracket
GuiClose:
	ExitApp()
	Return
} ; V1toV2: Added bracket in the end

image.png
image.png (96.08 KiB) Viewed 1093 times
image.png
image.png (71.24 KiB) Viewed 1093 times
Attachments
Screenshot 2023-04-18 120820.png
Screenshot 2023-04-18 120820.png (71.11 KiB) Viewed 1090 times
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

Return to “Scripts and Functions (v2)”