用GUICtrlGetHandle 得到 GUIBUTTON句柄后如何用gdi32着色
#include <GUIConstantsEx.au3>$locationx=@DesktopWidth-330
$mon=GUICreate("TEST MONITOR",320,200,$locationx,0)
$setinfowin=GUICtrlCreateButton("setinfo",0,0,80,40)
GUISetState(@SW_SHOW,$mon)
WinActivate("TEST MONITOR")
$setinfobutton = GUICtrlGetHandle($setinfowin)
MsgBox(0,"setinfobutton is",$setinfobutton)
sleep(2000)
$tBuffer = DllStructCreate("short r;short g;short b")
DllStructSetData($tBuffer, "r", 99)
DllStructSetData($tBuffer, "g", 66)
DllStructSetData($tBuffer, "b",99)
$iResult = DllCall("Gdi32.dll", "int", "SetDeviceGammaRamp", "hWnd", $setinfobutton, "ptr", DllStructGetPtr($tBuffer))
;SetMenuColor($setinfobutton, 0x99BBEE)
Sleep(20000) gdi 白痴 全部看不懂 _WinAPI_GetWindowInfo
_GDIPlus_BrushCreateSolid
_GDIPlus_GraphicsFillRectangles
不过是gdi++ 回复 3# netegg
是的 我就是不太懂api 函数的调用,能否帮忙大体解释下,谢谢 回复 4# pili
先看看帮助再说 回复 5# netegg
我找到一个winpi函数,_WINAPI_SETBKCOLOR($handle,$ncolor)但是 用guictrlgethandle得到的句柄仍然无法变色。
#include <WinAPI.au3>
$locationx=@DesktopWidth-330
$mon=GUICreate("TEST MONITOR",320,200,$locationx,0)
$setinfowin=GUICtrlCreateButton("setinfo",0,0,80,40)
GUISetState(@SW_SHOW,$mon)
WinActivate("TEST MONITOR")
;$hsetinfobutton = ControlGetHandle($setinfowin)
$hsetinfobutton = GUICtrlGetHandle($setinfowin)
If IsHWnd($hsetinfobutton) Then
MsgBox(4096, "", "ÊÇÓÐЧ¾ä±ú")
Else
MsgBox(4096, "", "²»ÊǾä±ú")
EndIf
;MsgBox(0,"setinfobutton is",$hsetinfobutton)
sleep(2000)
$h=_WinAPI_SetBkColor($hsetinfobutton, 0x00ff00)
MsgBox(0,"setinfobutton is",$h)
Sleep(20000)
RE: 用GUICtrlGetHandle 得到 GUIBUTTON句柄后如何用gdi32着色
回复 5# netegg我找到一个winpi函数,_WINAPI_SETBKCOLOR($handle,$ncolor)但是 用guictrlgethandle得到的句柄仍然无法变色。
#include <WinAPI.au3>
$locationx=@DesktopWidth-330
$mon=GUICreate("TEST MONITOR",320,200,$locationx,0)
$setinfowin=GUICtrlCreateButton("setinfo",0,0,80,40)
GUISetState(@SW_SHOW,$mon)
WinActivate("TEST MONITOR")
;$hsetinfobutton = ControlGetHandle($setinfowin)
$hsetinfobutton = GUICtrlGetHandle($setinfowin)
If IsHWnd($hsetinfobutton) Then
MsgBox(4096, "", "有效句柄")
Else
MsgBox(4096, "", "无效句柄")
EndIf
;MsgBox(0,"setinfobutton is",$hsetinfobutton)
sleep(2000)
$h=_WinAPI_SetBkColor($hsetinfobutton, 0x00ff00)
MsgBox(0,"setinfobutton is",$h)
Sleep(20000)
返回值为-1 执行失败
请帮忙看看 获取句柄后,找出按钮的矩形范围,gdi填充,如果有文字,gdi画上去
页:
[1]