PixPut() [v1.0]

作者: SKAN 最近更新时间: 20100914


Simplifies Drawing Colored Horizontal/Vertical lines and Solid Rectangles on GUI

PixClr( cHwnd, ColorRef=0 )
PixLst( Hwnd )
PixPut( Hwnd, ColorRef=0, X=0, Y=0, W=1, H=1, IsChild=0 )
PixRmv( cHwnd )
PixRmvAll( Hwnd )

关于函数的参数和返回值, 请参阅其源码或 此文档.

备注

Its not stdlib conform, because the functions do not have a prefix.

The library lacks an external documentation, so I *Tuncay* wrote a simple one.

The 'Set of Functions' is required only if you plan to create/delete static controls - at runtime - at large scale ( like in bar-graphing ).
For casual users, PixPut() as stand-alone will be sufficient, but remove the line DllCall( "SetProp", UInt,cHwnd, Str,"PixPut", UInt,hBMP ) from the PixPut() function.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=59248

许可

不存在

示例

; #Include PixPut.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; Example by SKAN, copied from his first posting at discussion page.
#SingleInstance, Force
SetBatchLines -1
Gui +LastFound -Caption
Gui1 := WinExist()
Gui, Show, w640 h480

PixPut( Gui1, 0xFF0000, 0, 0, 640, 2 )   ; Frame Top
PixPut( Gui1, 0xFF0000, 0, 0, 2, 480 )   ; Frame Left
PixPut( Gui1, 0xAA0000, 638, 0, 2, 480 ) ; Frame Right
PixPut( Gui1, 0xAA0000, 0, 478, 640, 2 ) ; Frame Bottom

; Create Vertical Lines
Loop 309
   BGR := DllCall( "shlwapi.dll\ColorHLSToRGB", Int,A_Index, Int,120, Int,240 )
 , RGB := ( BGR & 0xFF ) << 16 | (( BGR >> 8) & 0xFF ) | ( BGR >> 16 )
 , PixPut( Gui1, BGR, 10+(A_Index*2), 10, 2, 25 )

; Create Solid Blocks
PixPut( Gui1, 0xFF0000, 100, 100, 200, 200 ) ; R
PixPut( Gui1, 0x00FF00, 150, 150, 200, 200 ) ; G
PixPut( Gui1, 0x0000FF, 200, 200, 200, 200 ) ; B

; Create Horizontal Lines
PixPut( Gui1, 0xFF00FF, 10, 461, 620, 1 )    ; C
PixPut( Gui1, 0xFFFF00, 10, 462, 620, 1 )    ; Y
PixPut( Gui1, 0x00FFFF, 10, 463, 620, 1 )    ; M
PixPut( Gui1, 0x000000, 10, 464, 620, 1 )    ; K
Return

GuiEscape:
ExitApp