UDF > GUI > GuiListBox >


_GUICtrlListBox_SetItemHeight

Définit la hauteur, en pixels, d'un élément

#include <GuiListBox.au3>
_GUICtrlListBox_SetItemHeight ( $hWnd, $iHeight [, $iIndex = 0] )

Paramètres

$hWnd ID/handle du contrôle
$iHeight Hauteur, en pixels, de l'élément
$iIndex [optionnel] Index de l'élément dans la ListBox, compté à partir de 0.
A utiliser uniquement si le contrôle a le style $LBS_OWNERDRAWVARIABLE sinon, définir ce paramètre à 0.

Valeur de retour

Succès: Retourne True.
Échec: Retourne False.

En relation

_GUICtrlListBox_GetItemHeight

Exemple

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $idListBox

    ; Crée une GUI
    GUICreate("List Box Set Item Height", 400, 296)
    $idListBox = GUICtrlCreateList("", 2, 2, 396, 296)
    GUISetState(@SW_SHOW)

    ; Ajoute des chaînes
    _GUICtrlListBox_BeginUpdate($idListBox)
    For $iI = 1 To 9
        _GUICtrlListBox_AddString($idListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($idListBox)

    ; Affiche la hauteur des éléments
    MsgBox($MB_SYSTEMMODAL, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($idListBox))

    ; Définit la hauteur des éléments
    _GUICtrlListBox_SetItemHeight($idListBox, 26)

    ;  Affiche la hauteur des éléments
    MsgBox($MB_SYSTEMMODAL, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($idListBox))

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example