径向渐变填充.
#Include <WinAPIEx.au3>
_WinAPI_RadialGradientFill($hDC, $iX, $iY, $iRadius, $iRGB1, $iRGB2 [, $iAngleStart [, $iAngleEnd [, $iStep]]] )
$hDC | 设备环境句柄. |
$iX | 中心点 x 坐标逻辑单位. |
$iY | 中心点 y 坐标逻辑单位. |
$iRadius | 渐变填充的圆半径. |
$iRGB1 | 中心点的颜色. |
$iRGB2 | 圆的边缘颜色. |
$iAngleStart | [可选参数] 开始填充的角度值. |
$iAngleEnd | [可选参数] 结束填充的角度值. |
$iStep | [可选参数] 渐变填充步进值.此参数的值越大,渐变效果会更好. 但它需要更多的时间,反之值小用时少效果差. |
成功: | 返回 1. |
失败: | 返回 0,并设置@error标志为非 0 值. |
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global Const $STM_SETIMAGE = 0x0172
Global Const $STM_GETIMAGE = 0x0173
Global $hForm, $Pic, $hPic, $hObj, $hBitmap, $hDC, $hDestDC, $hDestSv
; 创建 GUI
$hForm = GUICreate('MyGUI', 400, 400)
$Pic = GUICtrlCreatePic('', 0, 0, 400, 400)
$hPic = GUICtrlGetHandle($Pic)
; 创建渐变
$hDC = _WinAPI_GetDC($hPic)
$hDestDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmapEx($hDC, 400, 400, 0xFFFFFF)
$hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap)
For $i = 0 To 315 Step 45
_WinAPI_RadialGradientFill($hDestDC, 200, 200, 180, Random(0, 0xFFFFFF, 1), 0xFFFFFF, $i, $i + 45)
Next
_WinAPI_ReleaseDC($hPic, $hDC)
_WinAPI_SelectObject($hDestDC, $hDestSv)
_WinAPI_DeleteDC($hDestDC)
; 设置渐变到控件
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
GUISetState()
Do
Until GUIGetMsg() = -3