Bonjour à tous,
Désolé pour le déterrage de Topic mais je suis sur l'action alors je partage, je sais que çà peut servir
Voili, voilou, sous windows X j'ai dû remplacer:
Code : Tout sélectionner
;~ DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 1)
;~ DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
par
Code : Tout sélectionner
; to allow the setting of Bk Color at least under Windows 10
_WinAPI_SetWindowTheme($hStatus, "", "")
Voici la démo redimensionnable
Code : Tout sélectionner
#include <Color.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>
#include <WinAPITheme.au3>
Global $Graphic
$color1 = 0xccaaaa
$color2 = 0x00f0ff
$hGUI = GUICreate("Gradient Demo Sizeable", 640, 480, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$hStatus = _GUICtrlStatusBar_Create( $hGUI)
; to allow the setting of Bk Color at least under Windows 10
_WinAPI_SetWindowTheme($hStatus, "", "")
Local $aParts[3] = [175, 260, -1], $SetBarHeight = 20
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetMinHeight( $hStatus, $SetBarHeight)
_GUICtrlStatusBar_SetText($hStatus, "Color : " & $color2, 0, $SBT_NOBORDERS)
_GUICtrlStatusBar_SetText($hStatus, "AkeReKouKou", 1, $SBT_NOBORDERS)
_GUICtrlStatusBar_SetText($hStatus, "", 2, $SBT_NOBORDERS)
_GUICtrlStatusBar_SetBkColor($hStatus, _WinAPI_SwitchColor( $color2)) ; _GUICtrlStatusBar_SetBkColor($hStatus, 0xf2e300)
$size = WinGetClientSize( $hGUI)
_GUICtrlCreateGradient($color1, $color2, 0, 0, $size[0], $size[1]-$SetBarHeight)
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")
GUISetState()
While 1
$msg = GUIGetMsg()
If $msg = -3 Then Exit
Wend
Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight)
Local $color1R = _ColorGetRed($nStartColor)
Local $color1G = _ColorGetGreen($nStartColor)
Local $color1B = _ColorGetBlue($nStartColor)
Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight
Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight
Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight
GUICtrlDelete( $Graphic)
$Graphic = GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight, $TCS_BOTTOM)
For $i = 0 To $nHeight - $nY
$sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff)
GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, $nWidth, $i)
Next
EndFunc
Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
$size = WinGetClientSize( $hGUI)
_GUICtrlCreateGradient($color1, $color2, 0, 0, $size[0], $size[1]-$SetBarHeight)
_GUICtrlStatusBar_Resize( $hStatus)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
La démo redimensionnable en plus light, merci walkson de m'avoir mis sur la bonne voie
Code : Tout sélectionner
#Include <GUIConstantsEx.au3>
#include <GuiConstants.au3>
#include <GuiStatusBar.au3>
#include <Timers.au3>
#Include <WinAPIEx.au3>
;~ Global Const $STM_SETIMAGE = 0x0172
;~ Global Const $STM_GETIMAGE = 0x0173
Local $nStartColor = 0x005530, $nEndColor = 0x005FFF ; Format RRGGBB
Local $iBgColor = 0x303030 ; Format RRGGBB
Local $iBarColor = 0x005fff ; Format RRGGBB
$hGUI = GUICreate('MyGUI', 600, 300, -1, -1, $WS_MINIMIZEBOX+$WS_MAXIMIZEBOX+$WS_SIZEBOX+$WS_CAPTION + $WS_SYSMENU) ; create a GUI for the bitmap
GUISetBkColor($iBgColor, $hGUI) ;set GUI background color
_GUICtrlCreateGradient( $hGUI, $nStartColor, $nEndColor, 0, 0, 600, 260)
Global $g_hStatus = _GUICtrlStatusBar_Create($hGUI)
Local $aParts[3] = [75, 150, -1]
_GUICtrlStatusBar_SetParts($g_hStatus, $aParts)
_GUICtrlStatusBar_SetBkColor($g_hStatus, _WinAPI_SwitchColor( $iBarColor))
_GUICtrlStatusBar_SetText($g_hStatus, "AAAA", 0)
_GUICtrlStatusBar_SetText($g_hStatus, "BBB", 1 )
_GUICtrlStatusBar_SetText($g_hStatus, "TIME", 2 )
_GUICtrlStatusBar_SetMinHeight($g_hStatus, 25)
_WinAPI_SetWindowTheme( $g_hStatus, "", "")
GUISetState()
_Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock")
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_Timer_KillAllTimers($hGUI)
GUIDelete($hGUI)
; #FUNCTION# ====================================================================================================================
; Author ........: mikell, Anthony Baillou, walkson
; Modified.......: Anthony Baillou, walkson
; ===============================================================================================================================
Func _GUICtrlCreateGradient( $hWnd, $nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight)
Dim $aVertex[2][3] = [[0, 0, $nStartColor], [@DesktopWidth, @DesktopHeight, $nEndColor]]
$hDC = _WinAPI_CreateCompatibleDC(0) ; create the bitmap
$hBitmap = _WinAPI_CreateBitmap( @DesktopWidth, @DesktopHeight, 1, 32)
$hSv = _WinAPI_SelectObject($hDC, $hBitmap)
_WinAPI_GradientFill($hDC, $aVertex, 0, 1) ; actual fill
_WinAPI_SelectObject($hDC, $hSv)
_WinAPI_DeleteDC($hDC)
GUICtrlCreatePic("", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSendMsg(-1, $STM_SETIMAGE, 0, $hBitmap)
GUICtrlSetPos( -1, $nX, $nY, $nWidth, $nHeight)
GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT)
EndFunc
Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
_GUICtrlStatusBar_Resize( $g_hStatus)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func _UpdateStatusBarClock($hWnd, $iMsg, $iIDTimer, $iTime)
#forceref $hWnd, $iMsg, $iIDTimer, $iTime
_GUICtrlStatusBar_SetText($g_hStatus,@TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc ;==>_UpdateStatusBarClock