I found this code below that generates a 3x1 gradient image. How can it be modified to only generate 1x1, single color?
I use this code for example because I like the simplicity. I've seen other GDI example code but there seems to be many more lines of code involved.
If you're curious, the 1x1 image would be used as a picture control in my Gui. It will be stretched to any size needed, helping to create backgrounds for different Gui design elements. I would like for the script itself to generate the images needed so that they would not need to be included with the script externally.
Code: Select all
GradientColorBand(151515)
GradientColorBand(RGB) {
file= ColorPicker_3x1.bmp
StringMid,R,RGB,1,2
StringMid,G,RGB,3,2
StringMid,B,RGB,5,2
Hs1:="424d42000000000000003600000028000000030000000100000001"
Hs2:="001800000000000c00000000000000000000000000000000000000"
Hs3:="FFFFFF" B G R "000000000000"
HexString:= Hs1 Hs2 Hs3
Handle:= DllCall("CreateFile","str",file,"Uint",0x40000000
,"Uint",0,"UInt",0,"UInt",4,"Uint",0,"UInt",0)
Loop 66 {
StringLeft, Hex, HexString, 2
StringTrimLeft, HexString, HexString, 2
Hex = 0x%Hex%
DllCall("WriteFile","UInt", Handle,"UChar *", Hex
,"UInt",1,"UInt *",UnusedVariable,"UInt",0)
}
DllCall("CloseHandle", "Uint", Handle)
Return File
}