#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 456, 263, 422, 304)
$Label1 = GUICtrlCreateLabel("颜色", 32, 24, 200, 50)
GUICtrlSetFont(-1,24)
GUICtrlSetColor($Label1,0xEC766C)
$Input1 = GUICtrlCreateInput("0xC08C53", 240, 8, 193, 21)
$Button1 = GUICtrlCreateButton("展示效果", 24, 208, 145, 33)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $color = GUICtrlRead($Input1)
GUICtrlSetColor($Label1,$color)
ShowLine(500 ,300, 200, 5, $color)
EndSwitch
WEnd
Func ShowLine($start_x, $start_y, $length, $width, $color)
Local $hDC, $hPen, $obj_orig
$hDC = _WinAPI_GetWindowDC(0) ; 全屏场景(桌面)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; 水平向左
Sleep(3000)
; 刷新桌面(清除)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
; 清除资源
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross
有些颜色,跟实际一样,有些颜色跟实际不一样,例如这个淡黄色的颜色,