Calculates the approximate height required to display a given number of items
#include <GuiListView.au3>
_GUICtrlListView_ApproximateViewHeight ( $hWnd [, $iCount = -1 [, $iCX = -1 [, $iCY = -1]]] )
$hWnd | Control ID/Handle to the control |
$iCount | [optional] Number of items to be displayed in the control. If this parameter is set to -1 the message uses the total number of items in the control. |
$iCX | [optional] Proposed X dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current width value. |
$iCY | [optional] Proposed Y dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current height value. |
Setting the size of the control based on the dimensions provided by this message can optimize redraw and reduce flicker.
_GUICtrlListView_ApproximateViewRect, _GUICtrlListView_ApproximateViewWidth
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>
Example()
Func Example()
Local $iY, $idListview
GUICreate("ListView Approximate View Height", 400, 300)
$idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState(@SW_SHOW)
; Add column
_GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100)
; Add items
For $iI = 0 To 9
_GUICtrlListView_AddItem($idListview, "Row " & $iI)
Next
MsgBox($MB_SYSTEMMODAL, "Information", "Approximate View Height")
; Resize view height
$iY = _GUICtrlListView_ApproximateViewHeight($idListview)
_WinAPI_SetWindowPos(GUICtrlGetHandle($idListview), 0, 2, 2, 394, $iY, $SWP_NOZORDER)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example