Last active
August 10, 2024 01:04
-
-
Save jNizM/53a3cea19463f1074cb1ad349e6cf238 to your computer and use it in GitHub Desktop.
[AHK] Create Gardient in GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; GLOBAL SETTINGS =============================================================================================================== | |
#NoEnv | |
#SingleInstance Force | |
SetBatchLines -1 | |
; GUI =========================================================================================================================== | |
Gui, +LastFound +hwndhMyGUI | |
Gui, Margin, 0, 0 | |
Gui, Add, Pic, x0 y0 w800 h600 0x4E hwndhPic01 | |
CreateGradient(hPic01, 800, 600, ["0x3399FF", "0xFF3399"]*) | |
Gui, Show, AutoSize | |
return | |
; FUNCTIONS ===================================================================================================================== | |
CreateGradient(handle, width, height, colors*) | |
{ | |
size := VarSetCapacity(bits, (ClrCnt := colors.MaxIndex()) * 2 * 4, 0) | |
addr := &bits | |
for each, color in colors | |
addr := NumPut(color, NumPut(color, addr + 0, "uint"), "uint") | |
hBitmap := DllCall("CreateBitmap", "int", 2, "int", ClrCnt, "uint", 1, "uint", 32, "ptr", 0, "ptr") | |
hBitmap := DllCall("CopyImage", "ptr", hBitmap, "uint", 0, "int", 0, "int", 0, "uint", 0x2008, "ptr") | |
DllCall("SetBitmapBits", "ptr", hBitmap, "uint", size, "ptr", &bits) | |
hBitmap := DllCall("CopyImage", "ptr", hBitmap, "uint", 0, "int", width, "int", height, "uint", 0x2008, "ptr") | |
DllCall("SendMessage", "ptr", handle, "uint", 0x0172, "ptr", 0, "ptr", hBitmap, "ptr") | |
return true | |
} | |
; EXIT ========================================================================================================================== | |
GuiClose: | |
GuiEscape: | |
ExitApp | |
; =============================================================================================================================== |
Wow looks useful 👍 though I wish it was v2.
here you go:
https://github.com/jNizM/ahk-scripts-v2/blob/main/src/Gui/CreateGradient.ahk
Thx! 😊
…________________________________
From: jNizM ***@***.***>
Sent: Friday, August 9, 2024 1:11 AM
To: jNizM ***@***.***>
Cc: Comment ***@***.***>
Subject: Re: jNizM/ahk_gui_gradient.ahk
@jNizM commented on this gist.
________________________________
Wow looks useful 👍 though I wish it was v2.
here you go:
https://github.com/jNizM/ahk-scripts-v2/blob/main/src/Gui/CreateGradient.ahk
—
Reply to this email directly, view it on GitHub<https://gist.github.com/jNizM/53a3cea19463f1074cb1ad349e6cf238#gistcomment-5148852> or unsubscribe<https://github.com/notifications/unsubscribe-auth/BHOG3N7MEGDUJJJNLA4P5NDZQR2SXBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA3TMMRQGY4DOM5HORZGSZ3HMVZKMY3SMVQXIZI>.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow looks useful 👍 though I wish it was v2.