Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiScrollBars_Ex.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <Date.au3>
#include <GuiEdit.au3>
;#include <Arret_Pause.au3>
#include <String.au3>
#include <ColorConstants.au3>
#Region ### Définition des variables
;#####################################
;Dimensionnement des fenetres ;#
;""""""""""""""""""""""""""""""" ;#
;-----Fenetre principale---- ;#
Global $Prpl_larg=@DesktopWidth*0.75 ;#
Global $Prpl_haut=@DesktopHeight*0.75 ;#
Global $Prpl_posx=@DesktopWidth*0.1 ;#
Global $Prpl_posy=@DesktopHeight*0.1 ;#
;-----Fenetre secondaire---- ;#
Global $Scnd_larg=$Prpl_larg*0.75 ;#
Global $Scnd_haut=$Prpl_haut*0.6 ;#
Global $Scnd_posx=$Prpl_larg-$Scnd_larg;#
Global $Scnd_posy=$Prpl_haut-$Scnd_haut;#
;#####################################
Global $Form1,$Form2,$Form3
#region ### Section des actions
Creation_Formes()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
#endregion
Func Creation_Formes()
;Création du Form principal
$Form1 = GUICreate("Gantt", $Prpl_larg, $Prpl_haut, $Prpl_posx, $Prpl_posy)
GUISetBkColor(0xDCE6F2)
$Button1 = GUICtrlCreateButton("Button1",0.1*$Prpl_posx,0.5*$Prpl_posy,$Prpl_larg*0.1,$Prpl_haut*0.1)
$ListView1 = GUICtrlCreateListView("Nom|Date de début|Date de fin",0,$Scnd_posy,$Scnd_posx,$Scnd_haut)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, $Scnd_posx*0.4)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, $Scnd_posx*0.3)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 2, $Scnd_posx*0.3)
GUISetState()
;Création du sous Forme (celui qui contiendra les progressbar du gantt)
$Form2=GUICreate("Form Mini",$Scnd_larg,$Scnd_haut,$Scnd_posx,$Scnd_posy,$WS_CHILD,-1,$Form1)
GUISetState()
$ScrollBar2=_GUIScrollbars_Generate($Form2,2000,1000)
$Form3=GUICreate("Dates Form",$Scnd_larg-18,$Scnd_haut/10,$Scnd_posx,$Scnd_posy-($Scnd_haut/10)-5,$WS_CHILD,-1,$Form1)
$ScrollBar3=_GUIScrollbars_Generate($Form3,2000)
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
EndFunc
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
;~ ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode
Case $SB_LINELEFT ; user clicked left arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
Case $SB_LINERIGHT ; user clicked right arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
If $hWnd = $form2 Then _GUIScrollBars_SetScrollInfo($form3, $SB_HORZ, $tSCROLLINFO)
If $hWnd = $form3 Then _GUIScrollBars_SetScrollInfo($form2, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL