以下是我发现的几个不错的示例
来源:https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3851
非标准Gui系列1
; https://www.autohotkey.com/boards/viewtopic.php?p=54001#p54001
; 已知问题:在Win11下显示不正常
SetBatchLines -1
#SingleInstance Force
GuiW := 530 ; GUI WIDTH
GuiH := 340 ; GUI HEIGHT
Gui -Caption +Resize -DPIScale
Gui Margin, 0, 0
Gui Color, FFFFFF ; GUI COLOR
; Gui Add, Text, % " x" 11 " y" 4 " w" 16 " h" 16 " +BackgroundTrans gGuiIcon" ; GUI ICON TRIGGER
; Gui Add, Picture, % " x" 11 " y" 4 " w" 16 " h" 16 , %A_AhkPath% ; GUI ICON
Gui Add, Text, % " x" 11 " y" 4 " w" 16 " h" 16 " +BackgroundTrans gGuiIcon" ; GUI 图标触发器
Gui Add, Picture, % " x" 11 " y" 4 " w" 16 " h" 16 , %A_AhkPath% ; GUI 图标
Gui, Font, s9 c444444, Segoe UI ; SET FONT OPTIONS
Gui Add, Text, % " x" 1 " y" 2 " w" GuiW-20 " +Center +BackgroundTrans", Window Title ; GUI TITLE TEXT
Gui, Font ; RESET FONT OPTIONS
Gui Add, Text, % " x" GuiW-89 " y" 0 " w" 29 " h" 26 " +BackgroundTrans gGuiMinimize" ; GUI最小化触发器
Gui Add, Text, % " x" GuiW-30 " y" 0 " w" 29 " h" 26 " +BackgroundTrans gGuiClose" ; GUI关闭触发器
Gui Add, Text, % " x" 1 " y" 0 " w" GuiW-2 " h" 28 " +BackgroundTrans gGuiMove" ; GUI移动触发器
右上角最小化按钮加载(GuiW, Color:="555555")
; 右上角最大化按钮加载(GuiW, "BBBBBB")
右上角关闭按钮加载(GuiW, "555555")
Gui Add, Progress, % " x" 1 " y" GuiH-23 " w" GuiW-2 " h" 22 " Background0072C6 hwndhBar", 0 ; GUI STATUSBAR
Gui, Font, s8 cFFFFFF, Segoe UI ; SET FONT OPTIONS
Gui Add, Text, % " x" 8 " y" GuiH-19 " w" GuiW-16 " +BackgroundTrans hwndhBarText", STATUSBAR TEXT ; GUI STATUSBAR TEXT
Gui, Font ; RESET FONT OPTIONS
Gui, Show, % " w" GuiW " h" GuiH, Office Style ; SHOW MAIN GUI
Return
GuiIcon:
SendInput, !{Space}
Return
GuiMinimize:
WinMinimize
Return
GuiMove:
PostMessage, 0xA1, 2,,, A
return
GuiClose:
ExitApp
Return
F1::
Loop 17
GuiControl, +BackgroundC42B1C, % hXTC%A_Index%
Return
; 为了使用窗口阴影,需要禁止改变窗口大小
WM_SIZING(wParam, lParam) {
Static init:=OnMessage(0x214, "WM_SIZING")
WinActivate, ahk_class Shell_TrayWnd
}
右上角最小化按钮加载(GuiW, Color:="555555") {
Global
; Gui Add, Progress, % " x" GuiW-80 " y" 8 " w" 9 " h" 2 " Background" Color " hwndhXTC1", 0 ; GUI 最小化
Gui Add, Progress, % " x" GuiW-50 " y" 8 " w" 9 " h" 2 " Background" Color " hwndhXTC1", 0 ; GUI 最小化
}
右上角最大化按钮加载(GuiW, Color:="BBBBBB") {
Gui Add, Progress, % " x" GuiW-50 " y" 4 " w" 11 " h" 2 " Background" Color, 0 ; GUI最大化顶部
Gui Add, Progress, % " x" GuiW-50 " y" 12 " w" 11 " h" 2 " Background" Color, 0 ; GUI最大化底部
Gui Add, Progress, % " x" GuiW-41 " y" 4 " w" 2 " h" 10 " Background" Color, 0 ; GUI最大化右侧
Gui Add, Progress, % " x" GuiW-50 " y" 4 " w" 2 " h" 10 " Background" Color, 0 ; GUI最大化左侧
}
右上角关闭按钮加载(GuiW, Color:="555555") {
Global
Gui Add, Progress, % " x" GuiW-20 " y" 4 " w" 1 " h" 1 " Background" Color " hwndhXTC2", 0 ; GUI关闭左上角 01
Gui Add, Progress, % " x" GuiW-21 " y" 5 " w" 3 " h" 1 " Background" Color " hwndhXTC3", 0 ; GUI关闭左上角 02
Gui Add, Progress, % " x" GuiW-20 " y" 6 " w" 3 " h" 1 " Background" Color " hwndhXTC4", 0 ; GUI关闭左上角 03
Gui Add, Progress, % " x" GuiW-13 " y" 4 " w" 1 " h" 1 " Background" Color " hwndhXTC5", 0 ; GUI关闭右上角 01
Gui Add, Progress, % " x" GuiW-14 " y" 5 " w" 3 " h" 1 " Background" Color " hwndhXTC6", 0 ; GUI关闭右上角 02
Gui Add, Progress, % " x" GuiW-15 " y" 6 " w" 3 " h" 1 " Background" Color " hwndhXTC7", 0 ; GUI关闭右上角 03
Gui Add, Progress, % " x" GuiW-19 " y" 7 " w" 6 " h" 1 " Background" Color " hwndhXTC8", 0 ; GUI关闭中心 01
Gui Add, Progress, % " x" GuiW-18 " y" 8 " w" 4 " h" 1 " Background" Color " hwndhXTC9", 0 ; GUI关闭中心 02
Gui Add, Progress, % " x" GuiW-18 " y" 9 " w" 4 " h" 1 " Background" Color " hwndhXTC10", 0 ; GUI关闭中心 03
Gui Add, Progress, % " x" GuiW-19 " y" 10 " w" 6 " h" 1 " Background" Color " hwndhXTC11", 0 ; GUI关闭中心 04
Gui Add, Progress, % " x" GuiW-20 " y" 11 " w" 3 " h" 1 " Background" Color " hwndhXTC12", 0 ; GUI关闭左下 01
Gui Add, Progress, % " x" GuiW-21 " y" 12 " w" 3 " h" 1 " Background" Color " hwndhXTC13", 0 ; GUI关闭左下 02
Gui Add, Progress, % " x" GuiW-20 " y" 13 " w" 1 " h" 1 " Background" Color " hwndhXTC14", 0 ; GUI关闭左下 03
Gui Add, Progress, % " x" GuiW-15 " y" 11 " w" 3 " h" 1 " Background" Color " hwndhXTC15", 0 ; GUI右下关闭 01
Gui Add, Progress, % " x" GuiW-14 " y" 12 " w" 3 " h" 1 " Background" Color " hwndhXTC16", 0 ; GUI右下关闭 02
Gui Add, Progress, % " x" GuiW-13 " y" 13 " w" 1 " h" 1 " Background" Color " hwndhXTC17", 0 ; GUI右下关闭 03
}
非标准Gui系列2
#NoEnv
#Warn
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
Menu Tray, Icon, shell32.dll, 131
Gui Body: New, LabelBody hWndhBody
Gui Color, White
Gui Add, Edit, x-1 y-1 w0 h0 ; Focus
Gui Font, s8 w700 cBlack, Segoe UI
Gui Add, Text, x10 y46 w187 h16, You re installing these programs.
Gui Font
Gui Font,, Segoe UI
Gui Add, Text, x10 y62 w456 h16 +0x200, As each item finishes, you can start using it while the others continue to install.
Gui Add, Text, x10 y80 w480 h1 0x10 ; Separator
If (FileExist(A_WinDir . "\System32\ieframe.dll")) {
Gui Add, Picture, x24 y90 w16 h16 Icon40, ieframe.dll
}
Gui Add, Text, x48 y90 w100 h16 +0x200, Installed
Gui Add, Text, x48 y107 w100 h16 +0x200, Installing
Gui Add, Text, x48 y124 w100 h16 +0x200, 100`% downloaded
Gui Font, w700 c0x0080ff, Segoe UI
Gui Add, Text, x164 y90 w100 h16 +0x200, Start Messenger
Gui Font
Gui Font, s8 w700, Segoe UI
Gui Add, Text, x164 y107 w100 h16 +0x200, Writer
Gui Font
Gui Font, w700 cBlack, Segoe UI
Gui Add, Text, x164 y124 w100 h16 +0x200, Sign-in Assistant
Gui Font
Gui Font,, Segoe UI
Gui Add, Text, x336 y90 w120 h16 +0x200, Done
Gui Font
Gui Add, Progress, x335 y108 w120 h16 -Smooth, 5
Gui Font, w700 cBlack, Segoe UI
Gui Add, Text, x10 y224 w480 h16 +0x200, Select any additional products you want to install.
Gui Font
Gui Add, Text, x10 y243 w480 h2 0x10 ; Separator
Gui Font, w700, Segoe UI
Gui Add, CheckBox, x33 y253 w42 h23, Mail
Gui Add, CheckBox, x33 y282 w60 h23, Toolbar
Gui Add, CheckBox, x33 y311 w92 h23, Photo Gallery
Gui Add, CheckBox, x33 y342 w92 h23, Family Safety
Gui Font
Gui Font,, Segoe UI
Gui Add, Text, x78 y253 w410 h23 +0x200, (15 MB) - Access all your e-mail accounts in one place
Gui Add, Text, x95 y282 w393 h23 +0x200, (5 MB) - Search from any Web page
Gui Add, Text, x126 y311 w362 h23 +0x200, (13 MB) - Easily organize, edit, and share your photos and videos
Gui Add, Text, x126 y341 w364 h23 +0x200, (3 MB) - Help keep your family safe online
Gui Add, Button, x14 y376 w110 h23 Disabled, Add to installation
Gui Font, c0x0080ff, Segoe UI
Gui Add, Text, x10 y400 w263 h25 +0x200, Learn more about these products
Gui Font
Gui Add, Progress, x-1 y430 w502 h49 Border, 0
Gui Font,, Segoe UI
Gui Add, Button, x413 y439 w75 h23 gBodyClose, Cancel
Gui Show, w499 h471, Windows Live Installer
Gui Header: New, -Caption +Parent%hBody%
Gui Header: Color, 0x008EBC
Gui Header: Add, Picture, x24 y6 w28 h28 Icon131, shell32.dll
Gui Font, s14 c0xF3F8FB, Ms Shell Dlg 2
Gui Header: Add, Text, x54 y1 w394 h38 +0x200 BackgroundTrans, Windows Live
Gui Font
Gui Header: Show, x0 y0 w500 h38
Gui Info: New, -Caption +Parent%hBody%
Gui Info: Color, 0xFFFFE1
Gui Info: Font,, Segoe UI
Gui Info: Add, Picture, x4 y4 w16 h16 Icon222, shell32.dll
Gui Info: Add, Text, x25 y0 w480 h23 +0x200, Installation may take a few minutes. Feel free to do other things while you wait.
Gui Info: Font
Gui Info: Show, x10 y196 w480 h23
Return
BodyClose:
ExitApp
非标准Gui系列3
#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWinDelay, -1 ; 修改窗口后发生的延迟
SetControlDelay, -1 ; 修改控件后发生的延迟
Application := {} ; Create Application Object
Application.Name := "New AutoHotkey Script"
Application.Version := "0.1"
Window := {} ; Create Window Object
Window.Width := 600
Window.Height := 400
Window.Title := Application.Name
Gui, +LastFound -Resize -Caption -Border +HWNDhGui1 -DPIScale
Gui, Color, FFFFFF
Gui, Margin, 10, 10
; Window Border 【边界线】
Gui, Add, Text, % " x" 0 " y" 0 " w" 1 " h" Window.Height " +0x4E +HWNDhBorderLeft"
Gui, Add, Text, % " x" Window.Width-1 " y" 0 " w" 1 " h" Window.Height " +0x4E +HWNDhBorderRight"
Gui, Add, Text, % "x" 1 " y" Window.Height-1 " w" Window.Width-2 " h" 1 " +0x4E +HWNDhBorderBottom"
DllCall("SendMessage", "Ptr", hBorderLeft, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB("0072C6", 1, 1))
DllCall("SendMessage", "Ptr", hBorderRight, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB("0072C6", 1, 1))
DllCall("SendMessage", "Ptr", hBorderBottom, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB("0072C6", 1, 1))
; Window 标头
Gui, Add, Text, % "x" 1 " y" 0 " w" Window.Width-2 " h" 36 " +0x4E +HWNDhTitleHeader"
DllCall("SendMessage", "Ptr", hTitleHeader, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB("0173C7", 1, 1))
; Window Title
Gui, Font, s9 cFFFFFF, Segoe UI ; Set font options
Gui, Add, Text, % " x" 140 " y" 12 " w" Window.Width-280 " +BackgroundTrans +0x101 +HWNDhTitle", % Window.Title
Gui, Font ; Reset font options
; Window Minimize Button
Gui, Add, Picture, % " x" Window.Width-139 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMinimizeN Hidden0"
Gui, Add, Picture, % " x" Window.Width-139 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMinimizeH Hidden1"
Gui, Add, Picture, % " x" Window.Width-139 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMinimizeP Hidden1"
ButtonMinimize := "####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################@@@@@@@@@@####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"
ButtonMinimizeN := 图标颜色转换(ButtonMinimize, "0173C7", "FFFFFF")
ButtonMinimizeH := 图标颜色转换(ButtonMinimize, "2A8AD4", "FFFFFF")
ButtonMinimizeP := 图标颜色转换(ButtonMinimize, "015C9F", "FFFFFF")
DllCall("SendMessage", "Ptr", hButtonMinimizeN, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMinimizeN, 46, 31))
DllCall("SendMessage", "Ptr", hButtonMinimizeH, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMinimizeH, 46, 31))
DllCall("SendMessage", "Ptr", hButtonMinimizeP, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMinimizeP, 46, 31))
; Window Maximize Button 【最大化按钮】
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMaximizeN Hidden0"
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMaximizeH Hidden1"
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonMaximizeP Hidden1"
ButtonMaximize := "##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################@@@@@@@@@@####################################@########@####################################@########@####################################@########@####################################@########@####################################@########@####################################@########@####################################@########@####################################@########@####################################@@@@@@@@@@############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"
ButtonMaximizeN := 图标颜色转换(ButtonMaximize, "0173C7", "FFFFFF")
ButtonMaximizeH := 图标颜色转换(ButtonMaximize, "2A8AD4", "FFFFFF")
ButtonMaximizeP := 图标颜色转换(ButtonMaximize, "015C9F", "FFFFFF")
DllCall("SendMessage", "Ptr", hButtonMaximizeN, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMaximizeN, 46, 31))
DllCall("SendMessage", "Ptr", hButtonMaximizeH, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMaximizeH, 46, 31))
DllCall("SendMessage", "Ptr", hButtonMaximizeP, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonMaximizeP, 46, 31))
; Window Restore Button【恢复按钮】
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonRestoreN Hidden1"
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonRestoreH Hidden1"
Gui, Add, Picture, % " x" Window.Width-93 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonRestoreP Hidden1"
ButtonRestore := "################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################@@@@@@@@######################################@######@####################################@@@@@@@@#@####################################@######@#@####################################@######@#@####################################@######@#@####################################@######@#@####################################@######@@@####################################@######@######################################@@@@@@@@##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"
ButtonRestoreN := 图标颜色转换(ButtonRestore, "0173C7", "FFFFFF")
ButtonRestoreH := 图标颜色转换(ButtonRestore, "2A8AD4", "FFFFFF")
ButtonRestoreP := 图标颜色转换(ButtonRestore, "015C9F", "FFFFFF")
DllCall("SendMessage", "Ptr", hButtonRestoreN, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonRestoreN, 46, 31))
DllCall("SendMessage", "Ptr", hButtonRestoreH, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonRestoreH, 46, 31))
DllCall("SendMessage", "Ptr", hButtonRestoreP, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonRestoreP, 46, 31))
; Window Close Button
Gui, Add, Picture, % " x" Window.Width-47 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonCloseN Hidden0"
Gui, Add, Picture, % " x" Window.Width-47 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonCloseH Hidden1"
Gui, Add, Picture, % " x" Window.Width-47 " y" 1 " w" 46 " h" 31 " +0x4E +HWNDhButtonCloseP Hidden1"
ButtonClose := "##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################-$######$-####################################$-$####$-$#####################################$-$##$-$#######################################$-$$-$#########################################$--$##########################################$--$#########################################$-$$-$#######################################$-$##$-$#####################################$-$####$-$####################################-$######$-############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"
ButtonCloseN := 图标颜色转换(ButtonClose, "0173C7", "4096D5", "FFFFFF")
ButtonCloseH := 图标颜色转换(ButtonClose, "E81123", "EE4C59", "FFFFFF")
ButtonCloseP := 图标颜色转换(ButtonClose, "F1707A", "F4939B", "FFFFFF")
DllCall("SendMessage", "Ptr", hButtonCloseN, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonCloseN, 46, 31))
DllCall("SendMessage", "Ptr", hButtonCloseH, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonCloseH, 46, 31))
DllCall("SendMessage", "Ptr", hButtonCloseP, "UInt", 0x172, "Ptr", 0, "Ptr", CreateDIB(ButtonCloseP, 46, 31))
Gui, Show, % " w" Window.Width " h" Window.Height, % Window.Title
OnMessage(0x200, "WM_MOUSEMOVE")
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x202, "WM_LBUTTONUP")
OnMessage(0x2A3, "WM_MOUSELEAVE")
VarSetCapacity(TME, 16, 0), NumPut(16, TME, 0), NumPut(2, TME, 4), NumPut(hGui1, TME, 8)
return ; End automatic execution
; ==============================================================================
图标颜色转换(iconStr, BackgroundColor, ForeColor1, ForeColor2:="") {
if (ForeColor2="") {
StringReplace, iconStr, iconStr, #, %BackgroundColor%|, All
StringReplace, iconStr, iconStr, @, %ForeColor1%|, All
} else {
StringReplace, iconStr, iconStr, #, %BackgroundColor%|, All
StringReplace, iconStr, iconStr, $, %ForeColor1%|, All
StringReplace, iconStr, iconStr, -, %ForeColor2%|, All
}
StringTrimRight, iconStr, iconStr, 1
Return iconStr
}
; Labels =======================================================================
GuiSize:
If (ErrorLevel = 1)
return ; 窗口已最小化。无需采取任何行动。
GuiControl, MoveDraw, %hTitleHeader%, % " w" A_GuiWidth-2
GuiControl, MoveDraw, %hBorderLeft%, % " h" A_GuiHeight
GuiControl, MoveDraw, %hBorderRight%, % " x" A_GuiWidth-1 " h" A_GuiHeight
GuiControl, MoveDraw, %hBorderBottom%, % " y" A_GuiHeight-1 " w" A_GuiWidth-2
GuiControl, MoveDraw, %hTitle%, % " w" A_GuiWidth-280
GuiControl, MoveDraw, %hButtonMinimizeN%, % " x" A_GuiWidth-139
GuiControl, MoveDraw, %hButtonMinimizeH%, % " x" A_GuiWidth-139
GuiControl, MoveDraw, %hButtonMinimizeP%, % " x" A_GuiWidth-139
GuiControl, MoveDraw, %hButtonMaximizeN%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonMaximizeH%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonMaximizeP%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonRestoreN%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonRestoreH%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonRestoreP%, % " x" A_GuiWidth-93
GuiControl, MoveDraw, %hButtonCloseN%, % " x" A_GuiWidth-47
GuiControl, MoveDraw, %hButtonCloseH%, % " x" A_GuiWidth-47
GuiControl, MoveDraw, %hButtonCloseP%, % " x" A_GuiWidth-47
return
GuiClose:
ExitSub:
ExitApp
return
; ==============================================================================
; Functions ====================================================================
WM_MOUSEMOVE(wParam, lParam, Msg, Hwnd) {
Global
DllCall("TrackMouseEvent", "UInt", &TME)
MouseGetPos,,,, MouseCtrl, 2
GuiControl, % (MouseCtrl = hButtonMinimizeN || MouseCtrl = hButtonMinimizeH) ? "Show" : "Hide", %hButtonMinimizeH%
GuiControl, % (MouseCtrl = hButtonMaximizeN || MouseCtrl = hButtonMaximizeH) ? "Show" : "Hide", %hButtonMaximizeH%
GuiControl, % (MouseCtrl = hButtonRestoreN || MouseCtrl = hButtonRestoreH) ? "Show" : "Hide", %hButtonRestoreH%
GuiControl, % (MouseCtrl = hButtonCloseN || MouseCtrl = hButtonCloseH) ? "Show" : "Hide", %hButtonCloseH%
}
WM_LBUTTONDOWN(wParam, lParam, Msg, Hwnd) {
Global
If (MouseCtrl = hTitleHeader || MouseCtrl = hTitle)
PostMessage, 0xA1, 2
GuiControl, % (MouseCtrl = hButtonMinimizeH) ? "Show" : "Hide", %hButtonMinimizeP%
GuiControl, % (MouseCtrl = hButtonMaximizeH) ? "Show" : "Hide", %hButtonMaximizeP%
GuiControl, % (MouseCtrl = hButtonRestoreH) ? "Show" : "Hide", %hButtonRestoreP%
GuiControl, % (MouseCtrl = hButtonCloseH) ? "Show" : "Hide", %hButtonCloseP%
}
WM_LBUTTONUP(wParam, lParam, Msg, Hwnd) {
Global
If (MouseCtrl = hButtonMinimizeP) {
WinMinimize
} Else If (MouseCtrl = hButtonMaximizeP || MouseCtrl = hButtonRestoreP) {
WinGet, MinMaxStatus, MinMax
If (MinMaxStatus = 1) {
WinRestore
GuiControl, Hide, %hButtonRestoreN%
} Else {
WinMaximize
GuiControl, Show, %hButtonRestoreN%
}
} Else If (MouseCtrl = hButtonCloseP) {
ExitApp
}
GuiControl, Hide, %hButtonMinimizeP%
GuiControl, Hide, %hButtonMaximizeP%
GuiControl, Hide, %hButtonRestoreP%
GuiControl, Hide, %hButtonCloseP%
}
WM_MOUSELEAVE(wParam, lParam, Msg, Hwnd) {
Global
GuiControl, Hide, %hButtonMinimizeH%
GuiControl, Hide, %hButtonMaximizeH%
GuiControl, Hide, %hButtonRestoreH%
GuiControl, Hide, %hButtonCloseH%
GuiControl, Hide, %hButtonMinimizeP%
GuiControl, Hide, %hButtonMaximizeP%
GuiControl, Hide, %hButtonRestoreP%
GuiControl, Hide, %hButtonCloseP%
}
CreateDIB(Input, W, H, ResizeW := 0, ResizeH := 0, Gradient := 1 ) {
WB := Ceil((W * 3) / 2) * 2, VarSetCapacity(BMBITS, (WB * H) + 1, 0), P := &BMBITS
Loop, Parse, Input, |
P := Numput("0x" . A_LoopField, P + 0, 0, "UInt") - (W & 1 && Mod(A_Index * 3, W * 3) = 0 ? 0 : 1)
hBM := DllCall("CreateBitmap", "Int", W, "Int", H, "UInt", 1, "UInt", 24, "Ptr", 0, "Ptr")
, hBM := DllCall("CopyImage", "Ptr", hBM, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2008, "Ptr")
, DllCall("SetBitmapBits", "Ptr", hBM, "UInt", WB * H, "Ptr", &BMBITS)
If (Gradient != 1)
hBM := DllCall("CopyImage", "Ptr", hBM, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x0008, "Ptr")
return DllCall("CopyImage", "Ptr", hBM, "Int", 0, "Int", ResizeW, "Int", ResizeH, "Int", 0x200C, "UPtr")
}
非标准Gui系列4
; Script Information ===========================================================
; Name: Material Design
; Description: Material Design inspired Gui
; AHK Version: 1.1.31.01 (Unicode 32-bit)
; OS Version: Windows 10
; Language: English (United States)
; Author: Weston Campbell (TheDewd) <westoncampbell@gmail.com>
; Filename: Material Design.ahk
; ==============================================================================
; Revision History =============================================================
; Revision 1 (2019-11-18)
; * Initial release
; ==============================================================================
; Auto-Execute =================================================================
#SingleInstance, Force ; Allow only one running instance of script
#Persistent ; Keep the script permanently running until terminated
#NoEnv ; Avoid checking empty variables for environment variables
;#Warn ; Enable warnings to assist with detecting common errors
;#NoTrayIcon ; Disable the tray icon of the script
#KeyHistory, 0 ; Keystroke and mouse click history
ListLines, Off ; The script lines most recently executed
SetWorkingDir, % A_ScriptDir ; Set the working directory of the script
SetBatchLines, -1 ; The speed at which the lines of the script are executed
SendMode, Input ; The method for sending keystrokes and mouse clicks
;DetectHiddenWindows, On ; The visibility of hidden windows by the script
SetWinDelay, 0 ; The delay to occur after modifying a window
SetControlDelay, 0 ; The delay to occur after modifying a control
OnExit("OnUnload") ; Run a subroutine or function when exiting the script
return ; End automatic execution
; ==============================================================================
; Labels =======================================================================
; TBD
; ==============================================================================
; Functions ====================================================================
OnLoad() {
Global ; Assume-global mode
Static Init := OnLoad() ; Call function
Menu, Tray, Tip, New AutoHotkey Script
; GDI+ Startup
hGdip := DllCall("Kernel32.dll\LoadLibrary", "Str", "Gdiplus.dll") ; Load module
VarSetCapacity(GdiplusStartupInput, (A_PtrSize = 8 ? 24 : 16), 0) ; GdiplusStartupInput structure
NumPut(1, GdiplusStartupInput, 0, "UInt") ; GdiplusVersion
DllCall("Gdiplus.dll\GdiplusStartup", "PtrP", pToken, "Ptr", &GdiplusStartupInput, "Ptr", 0) ; Initialize GDI+
TitleIcon := "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEVHcEz///+flKJDAAAAAXRSTlMAQObYZgAAAB9JREFUeAFj+FfP0OSIhIBcBhD5z5GBwRFIIssCFQMAWZEOVjbFLUEAAAAASUVORK5CYII="
ButtonMinimize := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdAQMAAAAErnd0AAAABlBMVEVHcEz///+flKJDAAAAAXRSTlMAQObYZgAAAA9JREFUeAFjoAeof0APWwCLxQFgXVzsZwAAAABJRU5ErkJggg=="
ButtonMaximize := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdAQMAAAAErnd0AAAABlBMVEVHcEz///+flKJDAAAAAXRSTlMAQObYZgAAABZJREFUeAFjoBjUPwBTDgokUzDtVAIAW/YFvwYcJbMAAAAASUVORK5CYII="
ButtonRestore := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdAQMAAAAErnd0AAAABlBMVEVHcEz///+flKJDAAAAAXRSTlMAQObYZgAAACJJREFUeAFjoBjIPwBTAgpgqn4BmHLARz2AUA0QDUCKOgAAgGoIrt5ErioAAAAASUVORK5CYII="
ButtonClose := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdAgMAAABDDg2kAAAACVBMVEVHcEz////////mcEUwAAAAAnRSTlMATAn5wIMAAAAtSURBVHgBYxgwoMIggeBIMqQgOGyOExAcxmkOSJoyGTA5CGWYBiCMRlg6OAAAS1UFoW2zwNkAAAAASUVORK5CYII="
ButtonHoverLight := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdAQMAAAAErnd0AAAABlBMVEX///9HcExwQjx2AAAAAnRSTlMPAPEL0fcAAAA/SURBVHgBY/gPAj8wqAf1YIqBH0T9Y2AHUX8YmIEUEDGCqA8MDJjUAwaGeqIoTO1Qo6EWQa2FOQLhJCDAQQEA9kh/fLXD4JsAAAAASUVORK5CYII="
ButtonHoverDark := "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAdCAYAAAA+YOU3AAAAW0lEQVR4Ae3XtxGAMADAQAZgLvIw7F9BRXQrR3Gn/gHHbty34hJdJPp8+lAMGoCSL8CDATgPBuA8GIAnAt+JLhLNg+8KQYsWLdp1WrQHJgDuJYCGe7FNkGgi0QdIuLX5HAI62QAAAABJRU5ErkJggg=="
hBMPTitleIcon := GdipCreateHBITMAPFromBase64(TitleIcon)
hBMPButtonMinimize := GdipCreateHBITMAPFromBase64(ButtonMinimize)
hBMPButtonMaximize := GdipCreateHBITMAPFromBase64(ButtonMaximize)
hBMPButtonRestore := GdipCreateHBITMAPFromBase64(ButtonRestore)
hBMPButtonClose := GdipCreateHBITMAPFromBase64(ButtonClose)
BMPButtonHoverLight := GdipCreateBitmapFromBase64(ButtonHoverLight)
BMPButtonHoverDark := GdipCreateBitmapFromBase64(ButtonHoverDark)
BMPButtonMinimize := GdipCreateBitmapFromBase64(ButtonMinimize)
BMPButtonMaximize := GdipCreateBitmapFromBase64(ButtonMaximize)
BMPButtonRestore := GdipCreateBitmapFromBase64(ButtonRestore)
BMPButtonClose := GdipCreateBitmapFromBase64(ButtonClose)
hBMPMinimizeHover := GdipCreateHBITMAPFromBitmap(GdiBitmapMerge(BMPButtonHoverLight, BMPButtonMinimize))
hBMPMaximizeHover := GdipCreateHBITMAPFromBitmap(GdiBitmapMerge(BMPButtonHoverLight, BMPButtonMaximize))
hBMPRestoreHover := GdipCreateHBITMAPFromBitmap(GdiBitmapMerge(BMPButtonHoverLight, BMPButtonRestore))
hBMPCloseHover := GdipCreateHBITMAPFromBitmap(GdiBitmapMerge(BMPButtonHoverLight, BMPButtonClose))
ButtonState := []
ButtonState["Minimize"] := 0
ButtonState["Maximize"] := 0
ButtonState["Restore"] := 0
ButtonState["Close"] := 0
}
OnUnload(ExitReason, ExitCode) {
Global ; Assume-global mode
; Clean up resources used by GDI+
DllCall("Gdiplus.dll\GdiplusShutdown", "Ptr", pToken)
}
GdipCreateBitmapFromBase64(B64) {
VarSetCapacity(B64Len, 0)
DllCall("Crypt32.dll\CryptStringToBinary", "Ptr", &B64, "UInt", StrLen(B64), "UInt", 0x01, "Ptr", 0, "UIntP", B64Len, "Ptr", 0, "Ptr", 0)
VarSetCapacity(B64Dec, B64Len, 0) ; pbBinary size
DllCall("Crypt32.dll\CryptStringToBinary", "Ptr", &B64, "UInt", StrLen(B64), "UInt", 0x01, "Ptr", &B64Dec, "UIntP", B64Len, "Ptr", 0, "Ptr", 0)
pStream := DllCall("Shlwapi.dll\SHCreateMemStream", "Ptr", &B64Dec, "UInt", B64Len, "UPtr")
VarSetCapacity(pBitmap, 0)
DllCall("Gdiplus.dll\GdipCreateBitmapFromStreamICM", "Ptr", pStream, "PtrP", pBitmap)
ObjRelease(pStream)
return pBitmap
}
GdipCreateHBITMAPFromBitmap(pBitmap) {
VarSetCapacity(hBitmap, 0)
DllCall("Gdiplus.dll\GdipCreateHBITMAPFromBitmap", "UInt", pBitmap, "UInt*", hBitmap, "Int", 0XFFFFFFFF)
return hBitmap
}
GdipCreateHICONFromBitmap(pBitmap) {
VarSetCapacity(hIcon, 0)
DllCall("Gdiplus.dll\GdipCreateHICONFromBitmap", "Ptr", pBitmap, "PtrP", hIcon, "UInt", 0)
return hIcon
}
GdipCreateHBITMAPFromBase64(B64) {
pBitmap := GdipCreateBitmapFromBase64(B64)
return GdipCreateHBITMAPFromBitmap(pBitmap)
}
GuiCreate() {
Global ; Assume-global mode
Static Init := GuiCreate() ; Call function
; Window Options -----------------------------------------------------------
Gui, +LastFound -Resize -Caption -Border +HWNDhMaterialDesign +MinSize800x600
Gui, Margin, 0, 0
; Window Border ------------------------------------------------------------
Gui, Add, Text, x0 y0 w800 h1 +0x4E HWNDhBorderTop
Gui, Add, Text, x0 y599 w800 h1 +0x4E HWNDhBorderBottom
Gui, Add, Text, x0 y1 w1 h598 +0x4E HWNDhBorderLeft
Gui, Add, Text, x799 y1 w1 h598 +0x4E HWNDhBorderRight
; Titlebar -----------------------------------------------------------------
Gui, Add, Text, x1 y1 w798 h30 +0x4E HWNDhTitlebar
Gui, Add, Picture, x8 y8 w16 h16 HWNDhTitleIcon +BackgroundTrans, % "HBITMAP:*" hBMPTitleIcon
Gui, Add, Text, x1 y31 w798 h1 +0x4E HWNDhTitlebarLine
Gui, Font, s9 cFFFFFF, Segoe UI
Gui, Add, Text, x30 y1 h30 w400 0x200 HWNDhTitlebarText +BackgroundTrans, Application
; Window Controls ----------------------------------------------------------
Gui, Add, Picture, x662 y1 w45 h29 HWNDhButtonMinimize +BackgroundTrans, % "HBITMAP:*" hBMPButtonMinimize
Gui, Add, Picture, x708 y1 w45 h29 HWNDhButtonMaximize +BackgroundTrans, % "HBITMAP:*" hBMPButtonMaximize
Gui, Add, Picture, x754 y1 w45 h29 HWNDhButtonClose +BackgroundTrans, % "HBITMAP:*" hBMPButtonClose
; Appbar -------------------------------------------------------------------
Gui, Add, Text, x1 y32 w798 h64 +0x4E HWNDhAppbar
; Body ---------------------------------------------------------------------
Gui, Add, Text, x1 y96 w200 h504 +0x4E HWNDhPanelLeft
Gui, Add, Text, x201 y96 w1 h504 +0x4E HWNDhDividerVert
Gui, Add, Text, x202 y96 w597 h504 +0x4E HWNDhPanelRight
;Gui, Font, s18 c000000
;Gui, Add, Text, x1 y700 +BackgroundTrans, TEST
CreatePixel(hBorderTop, "2E81D3")
CreatePixel(hBorderBottom, "2E81D3")
CreatePixel(hBorderLeft, "2E81D3")
CreatePixel(hBorderRight, "2E81D3")
CreatePixel(hTitlebar, "0069C0")
CreatePixel(hTitlebarLine, "48A8F4")
CreatePixel(hAppbar, "2196F3")
CreatePixel(hPanelLeft, "FAFAFA")
CreatePixel(hDividerVert, "D2D2D2")
CreatePixel(hPanelRight, "F5F5F5")
Gui, Show, w800 h600, Example
}
GuiSize(GuiHwnd, EventInfo, Width, Height) {
Global ; Assume-global mode
If (ErrorLevel = 1) { ; Window minimized
return
}
GuiControl, Move, % hBorderTop, % "w" Width " h1"
GuiControl, Move, % hBorderBottom, % "y" Height - 1 " w" Width
GuiControl, Move, % hBorderLeft, % "h" Height - 2
GuiControl, Move, % hBorderRight, % "x" Width - 1 " h" Height - 2
GuiControl, Move, % hTitlebar, % "w" Width - 2
GuiControl, Move, % hTitlebarText, % "w" Width - 170
GuiControl, Move, % hTitlebarLine, % "w" Width - 2
GuiControl, Move, % hAppbar, % "w" Width - 2
GuiControl, Move, % hPanelLeft, % "h" Height - 97
GuiControl, Move, % hPanelRight, % "w" Width - 204 " h" Height - 97
GuiControl, Move, % hDividerVert, % "h" Height - 97
GuiControl, MoveDraw, % hButtonClose, % "x" Width - 46
GuiControl, MoveDraw, % hButtonMaximize, % "x" Width - 92
GuiControl, MoveDraw, % hButtonMinimize, % "x" Width - 138
}
GuiEscape(GuiHwnd) {
ExitApp ; Terminate the script unconditionally
}
GuiClose(GuiHwnd) {
ExitApp ; Terminate the script unconditionally
}
WM_SIZE(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0005, "WM_SIZE") ; Call function
If (A_Gui = 1) {
Width := lParam & 0xFFFF, Height := lParam >> 16
WinGet, WinMax, MinMax
If (WinMax = 1) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonRestore
} Else If (WinMax = 0) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonMaximize
}
}
}
WM_MOUSEMOVE(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0200, "WM_MOUSEMOVE")
MouseGetPos, MouseX, MouseY, MouseWin, MouseCtl, 2
VarSetCapacity(TME, 16, 0)
NumPut(16, TME, 0)
NumPut(2, TME, 4) ; TME_LEAVE
NumPut(MouseWin, TME, 8)
DllCall("User32.dll\TrackMouseEvent", "UInt", &TME)
If (MouseCtl = hButtonMinimize && ButtonState["Minimize"] <> 1) {
GuiControl,, % hButtonMinimize, % "HBITMAP:*" hBMPMinimizeHover
ButtonState["Minimize"] := 1
} Else If (MouseCtl <> hButtonMinimize && ButtonState["Minimize"] = 1) {
GuiControl,, % hButtonMinimize, % "HBITMAP:*" hBMPButtonMinimize
ButtonState["Minimize"] := 0
}
If (MouseCtl = hButtonMaximize) {
WinGet, WinMax, MinMax
If (WinMax = 1 && ButtonState["Restore"] <> 1) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPRestoreHover
ButtonState["Restore"] := 1
} Else If (WinMax <> 1 && ButtonState["Maximize"] <> 1) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPMaximizeHover
ButtonState["Maximize"] := 1
}
} Else If (MouseCtl <> hButtonMaximize) {
WinGet, WinMax, MinMax
If (WinMax = 1 && ButtonState["Restore"] = 1) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonRestore
ButtonState["Restore"] := 0
} Else If (WinMax <> 1 && ButtonState["Maximize"] = 1) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonMaximize
ButtonState["Maximize"] := 0
}
}
If (MouseCtl = hButtonClose && ButtonState["Close"] <> 1) {
GuiControl,, % hButtonClose, % "HBITMAP:*" hBMPCloseHover
ButtonState["Close"] := 1
} Else If (MouseCtl <> hButtonClose && ButtonState["Close"] = 1) {
GuiControl,, % hButtonClose, % "HBITMAP:*" hBMPButtonClose
ButtonState["Close"] := 0
}
}
WM_MOUSELEAVE(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x02A3, "WM_MOUSELEAVE")
If (ButtonState["Minimize"] <> 0) {
GuiControl,, % hButtonMinimize, % "HBITMAP:*" hBMPButtonMinimize
ButtonState["Minimize"] := 0
} Else If (ButtonState["Maximize"] <> 0) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonMaximize
ButtonState["Maximize"] := 0
} Else If (ButtonState["Restore"] <> 0) {
GuiControl,, % hButtonMaximize, % "HBITMAP:*" hBMPButtonRestore
ButtonState["Restore"] := 0
} Else If (ButtonState["Close"] <> 0) {
GuiControl,, % hButtonClose, % "HBITMAP:*" hBMPButtonClose
ButtonState["Close"] := 0
}
}
WM_LBUTTONDOWN(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0201, "WM_LBUTTONDOWN") ; Call function
If (A_Gui = 1) {
If (MouseCtl = hTitleIcon) {
PostMessage, 0x112, 0xF100, 0x20 ; WM_SYSCOMMAND := 0x112 ;SC_KEYMENU := 0xF100
} Else If (MouseCtl = hTitlebarText) {
PostMessage, 0xA1, 2 ; 0xA1 := WM_NCLBUTTONDOWN / 2 := HTCAPTION
}
}
}
WM_LBUTTONUP(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0202, "WM_LBUTTONUP")
If (A_Gui = 1) {
If (MouseCtl = hButtonClose) {
ExitApp
} Else If (MouseCtl = hButtonMaximize) {
WinGet, WinMax, MinMax
If (WinMax = 1) {
WinRestore
} Else If (WinMax = 0) {
Gui, +Caption
WinMaximize
Gui, -Caption
}
} Else If (MouseCtl = hButtonMinimize) {
WinMinimize
}
}
}
WM_RBUTTONUP(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0205, "WM_RBUTTONUP") ; Call function
If (A_Gui = 1) {
If (MouseCtl = hTitleIcon) {
PostMessage, 0x112, 0xF100, 0x20 ; SysMenu
}
}
}
WM_LBUTTONDBLCLK(wParam, lParam, Msg, Hwnd) {
Global ; Assume-global mode
Static Init := OnMessage(0x0203, "WM_LBUTTONDBLCLK")
If (A_Gui = 1) {
If (MouseCtl = hTitlebarText) {
WinGet, WinMax, MinMax
If (WinMax = 1) {
WinRestore
} Else If (WinMax = 0) {
Gui, +Caption
WinMaximize
Gui, -Caption
}
}
}
}
WM_NCHITTEST(wParam, lParam, Msg, Hwnd) { ; Define sizing borders
Static Init := OnMessage(0x0084, "WM_NCHITTEST") ; Call function
Static BSZ := 6 ; Border Size
If (A_Gui = 1) {
WinGetPos, gX, gY, gW, gH
X := (lParam << 48 >> 48)
Y := (lParam << 32 >> 48)
HL := (X < (gX + BSZ))
HR := (X >= ((gX + gW) - BSZ))
HT := (Y < (gY + BSZ))
HB := (Y >= ((gY + gH) - BSZ))
; Enable window resizing
If (HL || HR || HT || HB)
|| (HT & HL || HT & HR || HB & HL || HB & HR) {
WinGet, Style, Style
If !(Style & 0x40000) {
Gui, +Resize
}
}
If (HT) {
return (HL ? 0xD : HR ? 0xE : 0xC)
} Else If (HB) {
return (HL ? 0x10 : HR ? 0x11 : 0xF)
} Else If (HL) {
return 0xA
} Else If (HR) {
return 0xB
}
}
}
WM_NCCALCSIZE(wParam, lParam, Msg, Hwnd) { ; Size the client area to fill entire window
Static Init := OnMessage(0x0083, "WM_NCCALCSIZE") ; Call function
If (A_Gui = 1) {
return 0
}
}
WM_NCACTIVATE(wParam, lParam, Msg, Hwnd) { ; Prevent drawing border when activating window
Static Init := OnMessage(0x0086, "WM_NCACTIVATE") ; Call function
If (A_Gui = 1) {
return 1
}
}
CreatePixel(HWND, HexColor) {
hBitmap := DllCall("Gdi32.dll\CreateBitmap", "Int", 1, "Int", 1, "UInt", 1, "UInt", 24, "Ptr", 0, "Ptr")
hBM := DllCall("User32.dll\CopyImage", "Ptr", hBitmap, "UInt", 0, "Int", 0, "Int", 0, "UInt", 8, "Ptr")
VarSetCapacity(BMBITS, 5, 0)
Numput("0x" HexColor, &BMBITS, 0, "UInt")
DllCall("Gdi32.dll\SetBitmapBits", "Ptr", hBM, "UInt", 4, "Ptr", &BMBITS)
DllCall("User32.dll\SendMessage", "Ptr", HWND, "UInt", 0x0172, "Ptr", 0, "Ptr", hBM, "Ptr")
DllCall("Gdi32.dll\DeleteObject", "Ptr", hBitmap)
}
GdiBitmapMerge(Bitmap1, Bitmap2) {
DllCall("Gdiplus.dll\GdipGetImageWidth", "UPtr", Bitmap1, "UInt*", Width)
DllCall("Gdiplus.dll\GdipGetImageHeight", "UPtr", Bitmap1, "UInt*", Height)
DllCall("Gdiplus.dll\GdipCreateBitmapFromScan0", "Int", Width, "Int", Height, "Int", 0, "Int", 0x26200A, "UPtr", 0, "UPtr*", BitmapNew)
DllCall("Gdiplus.dll\GdipGetImageGraphicsContext", "UPtr", BitmapNew, "UPtr*", pGraphics)
DllCall("Gdiplus.dll\GdipDrawImageRectRect", "Ptr", pGraphics, "Ptr", Bitmap1, "Float", 0, "Float", 0, "Float", Width, "Float", Height, "Float", 0, "Float", 0, "Float", Width, "Float", Height, "Int", 2, "Ptr", 0, "Ptr", 0, "Ptr", 0)
DllCall("Gdiplus.dll\GdipDrawImageRectRect", "Ptr", pGraphics, "Ptr", Bitmap2, "Float", 0, "Float", 0, "Float", Width, "Float", Height, "Float", 0, "Float", 0, "Float", Width, "Float", Height, "Int", 2, "Ptr", 0, "Ptr", 0, "Ptr", 0)
DllCall("Gdiplus.dll\GdipDeleteGraphics", "UPtr", pGraphics)
return BitmapNew
}
; ==============================================================================
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。

评论(0)