#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPIEx.au3>
;=====================================================================================
HotKeySet("+{ESC}", "vyx")
;==================================================================================
Global Const $STM_SETIMAGE = 0x0172
Global Const $STM_GETIMAGE = 0x0173
Global $iTimer = 1005
Global $Form2 = GUICreate('w', 700, 500, -1, -1)
;GUISetBkColor(0x000000)
Global $Button = GUICtrlCreateButton(" color ",300, 300, 100, 30)
Global $iWidth11 = 300
Global $iHeight11 = 50
Global $Form11 = GUICreate("",$iWidth11, $iHeight11, 55, 55, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim11 = GUICtrlCreateGradient($Form11, 50, 0x000033)
Global $iWidth12 = 110
Global $iHeight12 = 50
Global $Form12 = GUICreate("",$iWidth12, $iHeight12, 55, 220, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim12 = GUICtrlCreateGradient($Form12, 50, 0x000033)
GUISetState(@SW_SHOW,$Form2)
GUISetState(@SW_SHOW,$Form11)
GUISetState(@SW_SHOW,$Form12)
_GDIPlus_Startup()
Global $hGraphic11 = _GDIPlus_GraphicsCreateFromHWND($Form11)
Global $hBitmap11 = _GDIPlus_BitmapCreateFromGraphics($iWidth11, $iHeight11, $hGraphic11)
Global $hBackbuffer11 = _GDIPlus_ImageGetGraphicsContext($hBitmap11)
Global $hBrushYellow11 = _GDIPlus_BrushCreateSolid(0xFF000000) ; кисть для цифр
Global $hFormat11 = _GDIPlus_StringFormatCreate() ; формат текста
Global $hFamily11 = _GDIPlus_FontFamilyCreate('Tahoma') ; шрифт текста
Global $hFont11 = _GDIPlus_FontCreate($hFamily11, 14) ; размер шрифта
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer11, 2)
GUIRegisterMsg($WM_ERASEBKGND, 'WM_ERASEBKGND')
AdlibRegister("SetTimer", 1000)
AdlibRegister('tim1',1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
; удаление ресурсов
_GDIPlus_FontDispose($hFont11)
_GDIPlus_FontFamilyDispose($hFamily11)
_GDIPlus_StringFormatDispose($hFormat11)
_GDIPlus_BrushDispose($hBrushYellow11)
_GDIPlus_GraphicsDispose($hGraphic11)
_GDIPlus_BitmapDispose($hBitmap11)
_GDIPlus_GraphicsDispose($hBackbuffer11)
_GDIPlus_Shutdown()
Exit
Case $Button
color()
EndSwitch
WEnd
; создаёт градиент (пример с форума)
Func GUICtrlCreateGradient($Form11, $iHeight11, $iColor)
Local $aVertex, $aClientSize, $hPic, $hDC, $hDestDC, $hBitmap, $hDestSv, $hObj
$aClientSize = WinGetClientSize($Form11)
$Pic = GUICtrlCreatePic("", 0, 0, $aClientSize[0], $iHeight11)
$hPic = GUICtrlGetHandle(-1)
Dim $aVertex[2][3] = [[0, 0, 0xFFFFFF],[ $aClientSize[0], $iHeight11, $iColor]]
$hDC = _WinAPI_GetDC($hPic)
$hDestDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aClientSize[0], $iHeight11)
$hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap)
_WinAPI_GradientFill($hDestDC, $aVertex)
_WinAPI_ReleaseDC($hPic, $hDC)
_WinAPI_SelectObject($hDestDC, $hDestSv)
_WinAPI_DeleteDC($hDestDC)
; Set gradient to control
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
EndFunc ;==>GUICtrlCreateGradient
Func sterkatim()
_GDIPlus_GraphicsDispose($hGraphic11) ; удаление ресурсов
_GDIPlus_BitmapDispose($hBitmap11)
_GDIPlus_GraphicsDispose($hBackbuffer11)
_GDIPlus_Startup()
Global $hGraphic11 = _GDIPlus_GraphicsCreateFromHWND($Form11)
Global $hBitmap11 = _GDIPlus_BitmapCreateFromGraphics($iWidth11, $iHeight11, $hGraphic11)
Global $hBackbuffer11 = _GDIPlus_ImageGetGraphicsContext($hBitmap11)
EndFunc
Func tim1()
sterkatim()
$grtim11 = GUICtrlCreateGradient($Form11, 50, 0x000033)
GUISetState(@SW_SHOW,$Form11)
Local $tLayout11
$tLayout11 = _GDIPlus_RectFCreate(11, 11, 0, 0) ; координаты для вывода цифр
_GDIPlus_GraphicsDrawStringEx($hGraphic11, Round($iTimer, 3) &' '& 's', $hFont11, $tLayout11, $hFormat11, $hBrushYellow11) ; вывод цифр
_GDIPlus_GraphicsDrawImageRect($hGraphic11, $hBitmap11, 0, 0, $iWidth11, $iHeight11)
EndFunc
Func WM_ERASEBKGND()
_GDIPlus_GraphicsDrawImageRect($hGraphic11, $hBitmap11, 0, 0, $iWidth11, $iHeight11)
EndFunc
; таймер
Func SetTimer()
$iTimer -= 1
EndFunc
Func color()
GUISetBkColor(0x000000,$Form2)
EndFunc
; выход по Esc.
Func vyx()
Sleep (300)
Exit
EndFunc
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPIEx.au3>
#include <StaticConstants.au3>
;=====================================================================================
HotKeySet("+{ESC}", "vyx")
;==================================================================================
Global Const $STM_SETIMAGE = 0x0172
Global Const $STM_GETIMAGE = 0x0173
Global $iTimer = 1005
Global $Form2 = GUICreate('w', 700, 500, -1, -1)
;GUISetBkColor(0x000000)
GUISetState()
Global $lll = GUICtrlCreateLabel($iTimer, 90, 70, 50, 22, BitOR($SS_CENTER,$SS_CENTERIMAGE));,$GUI_BKCOLOR_TRANSPARENT)
Global $Button = GUICtrlCreateButton(" color ",300, 300, 100, 30)
Global $iWidth11 = 300
Global $iHeight11 = 50
Global $Form11 = GUICreate("",$iWidth11, $iHeight11, 55, 55, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim11 = GUICtrlCreateGradient($Form11, 50, 0x000033)
Global $monic1cena11 = GUICtrlCreateLabel(-1,$iTimer, 5, 5, 30, 12)
GUISetState(@SW_SHOW,$Form11)
Global $iWidth12 = 110
Global $iHeight12 = 50
Global $Form12 = GUICreate("",$iWidth12, $iHeight12, 55, 220, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim12 = GUICtrlCreateGradient($Form12, 50, 0x000033)
GUISetState(@SW_SHOW,$Form2)
GUISetState(@SW_SHOW,$Form11)
GUISetState(@SW_SHOW,$Form12)
AdlibRegister('SetTimer',1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
color()
EndSwitch
WEnd
; создаёт градиент (пример с форума)
Func GUICtrlCreateGradient($Form11, $iHeight11, $iColor)
Local $aVertex, $aClientSize, $hPic, $hDC, $hDestDC, $hBitmap, $hDestSv, $hObj
$aClientSize = WinGetClientSize($Form11)
$Pic = GUICtrlCreatePic("", 0, 0, $aClientSize[0], $iHeight11)
$hPic = GUICtrlGetHandle(-1)
Dim $aVertex[2][3] = [[0, 0, 0xFFFFFF],[ $aClientSize[0], $iHeight11, $iColor]]
$hDC = _WinAPI_GetDC($hPic)
$hDestDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aClientSize[0], $iHeight11)
$hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap)
_WinAPI_GradientFill($hDestDC, $aVertex)
_WinAPI_ReleaseDC($hPic, $hDC)
_WinAPI_SelectObject($hDestDC, $hDestSv)
_WinAPI_DeleteDC($hDestDC)
; Set gradient to control
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
EndFunc ;==>GUICtrlCreateGradient
; таймер
Func SetTimer()
Local $rrr
$iTimer -= 1
$rrr = $iTimer
GUICtrlSetData($lll,$rrr)
EndFunc
Func color()
GUISetBkColor(0x000000,$Form2)
EndFunc
; выход по Esc.
Func vyx()
Sleep (300)
Exit
EndFunc
$GUI_BKCOLOR_TRANSPARENT
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPIEx.au3>
#include <StaticConstants.au3>
;=====================================================================================
HotKeySet("+{ESC}", "vyx")
;==================================================================================
Global Const $STM_SETIMAGE = 0x0172
Global Const $STM_GETIMAGE = 0x0173
Global $iTimer = 1005
Global $Form2 = GUICreate('w', 700, 500, -1, -1)
;GUISetBkColor(0x000000)
GUISetState()
Global $Button = GUICtrlCreateButton(" color ",300, 300, 100, 30)
Global $iWidth11 = 300
Global $iHeight11 = 50
Global $Form11 = GUICreate("",$iWidth11, $iHeight11, 55, 55, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim11 = GUICtrlCreateGradient($Form11, 50, 0x000033)
Global $lll = GUICtrlCreateLabel($iTimer, 11, 11, 80, 22)
GUICtrlSetBkColor($lll,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 16, 600, 0, "MS Sans Serif")
GUICtrlSetColor($lll, 0x0f00CC)
Global $monic1cena11 = GUICtrlCreateLabel(-1,$iTimer, 5, 5, 30, 12)
GUISetState(@SW_SHOW,$Form11)
Global $iWidth12 = 110
Global $iHeight12 = 50
Global $Form12 = GUICreate("",$iWidth12, $iHeight12, 55, 220, BitOR($DS_SETFOREGROUND,$WS_CHILD),-1,$Form2) ; дочернее окно
Global $grtim12 = GUICtrlCreateGradient($Form12, 50, 0x000033)
GUISetState(@SW_SHOW,$Form2)
GUISetState(@SW_SHOW,$Form11)
GUISetState(@SW_SHOW,$Form12)
AdlibRegister('SetTimer',1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
color()
EndSwitch
WEnd
; создаёт градиент (пример с форума)
Func GUICtrlCreateGradient($Form11, $iHeight11, $iColor)
Local $aVertex, $aClientSize, $hPic, $hDC, $hDestDC, $hBitmap, $hDestSv, $hObj
$aClientSize = WinGetClientSize($Form11)
$Pic = GUICtrlCreatePic("", 0, 0, $aClientSize[0], $iHeight11)
$hPic = GUICtrlGetHandle(-1)
Dim $aVertex[2][3] = [[0, 0, 0xFFFFFF],[ $aClientSize[0], $iHeight11, $iColor]]
$hDC = _WinAPI_GetDC($hPic)
$hDestDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aClientSize[0], $iHeight11)
$hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap)
_WinAPI_GradientFill($hDestDC, $aVertex)
_WinAPI_ReleaseDC($hPic, $hDC)
_WinAPI_SelectObject($hDestDC, $hDestSv)
_WinAPI_DeleteDC($hDestDC)
; Set gradient to control
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
EndFunc ;==>GUICtrlCreateGradient
; таймер
Func SetTimer()
$iTimer -= 1
GUICtrlSetData($lll,$iTimer & ' ' & 's')
EndFunc
Func color()
GUISetBkColor(0x000000,$Form2)
EndFunc
; выход по Esc.
Func vyx()
Sleep (300)
Exit
EndFunc