Войти

Показать полную графическую версию : Убрать гор. полосу прокрутки в GUICtrlCreateListView


morgan1991
09-04-2010, 12:04
Здравствуйте!
Помогите пожалуйста скрыть горизонтальную полосу прокрутки в GUICtrlCreateListView.

morgan1991
25-11-2010, 22:27
Up.

Yashied
26-11-2010, 00:11
Нужно просто уменьшить размеры колонок, чтобы все они вмещались в размеры списка.

madmasles
26-11-2010, 04:38
morgan1991,
Можно еще так поизвращаться :)
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GuiConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GuiListView.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <Constants.au3>

GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("", 400, 300)
$ListView = GUICtrlCreateListView (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateListView.htm)("", 10, 10, 380, 280, BitOR (http://www.autoitscript.com/autoit3/docs/functions/BitOR.htm)($LVS_SHOWSELALWAYS, $LVS_REPORT))
$hListView = GUICtrlGetHandle (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlGetHandle.htm)($ListView)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()

_GUICtrlListView_AddColumn (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_addcolumn.htm)($hListView, "Column 1", 50)
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) Random (http://www.autoitscript.com/autoit3/docs/functions/Random.htm)(5, 15, 1)
$sString = ''
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $j = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) Random (http://www.autoitscript.com/autoit3/docs/functions/Random.htm)(5, 25, 1)
$sString &= Chr (http://www.autoitscript.com/autoit3/docs/functions/Chr.htm)(Random (http://www.autoitscript.com/autoit3/docs/functions/Random.htm)(65, 90, 1))
$sString &= Chr (http://www.autoitscript.com/autoit3/docs/functions/Chr.htm)(Random (http://www.autoitscript.com/autoit3/docs/functions/Random.htm)(97, 122, 1))
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
_GUICtrlListView_AddItem (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_additem.htm)($hListView, $sString)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(0, '', 'Подгоняем размеры ListView.')

$iItemCount = _GUICtrlListView_GetItemCount (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_getitemcount.htm)($hListView)
Dim (http://www.autoitscript.com/autoit3/docs/keywords.htm#Dim) $aItem[$iItemCount]
$iLenMax = 0
$j = 0
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 0 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) $iItemCount - 1
$aItem[$i] = _GUICtrlListView_GetItemText (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_getitemtext.htm)($hListView, $i)
$aItemLen = _GUICtrlListView_GetStringWidth (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_getstringwidth.htm)($hListView, $aItem[$i])
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $aItemLen > $iLenMax Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$iLenMax = $aItemLen
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)

_GUICtrlListView_SetColumnWidth (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_setcolumnwidth.htm)($hListView, 0, $iLenMax + 10)
$iY = _GUICtrlListView_ApproximateViewHeight (http://dundats.mvps.org/help/html/libfunctions/_guictrllistview_approximateviewheight.htm)($hListView)
$iLeft = Round (http://www.autoitscript.com/autoit3/docs/functions/Round.htm)((400 - $iLenMax - 20) / 2)
_WinAPI_SetWindowPos (http://dundats.mvps.org/help/html/libfunctions/_winapi_setwindowpos.htm)($hListView, 0, $iLeft, 10, $iLenMax + 20, $iY, $SWP_NOZORDER)
Do (http://www.autoitscript.com/autoit3/docs/keywords.htm#Do)
Until (http://www.autoitscript.com/autoit3/docs/keywords.htm#Until) GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)() = $GUI_EVENT_CLOSE




© OSzone.net 2001-2012