[已解决]ListView 显示异常求助
本帖最后由 onestone01 于 2019-12-21 19:41 编辑ListView 控件,我是用图片背景。演示用(Label)
后面有背景时,一拉宽列表就显示不正常
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
GUICreate("列表视图控件", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; 将改变背景颜色
GUICtrlCreateLabel('', 10, 10, 200, 150);这里是图片背景,演示
;GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idListview = GUICtrlCreateListView("列 1|列 2|列 3", 10, 10, 200, 150) ;,$LVS_SORTDESCENDING)
Local $idButton = GUICtrlCreateButton("测试", 75, 170, 70, 20)
Local $idItem1 = GUICtrlCreateListViewItem("条目2|col22|col23", $idListview)
Local $idItem2 = GUICtrlCreateListViewItem("条目1|子目2|子目3", $idListview)
Local $idItem3 = GUICtrlCreateListViewItem("条目3|col32|col33", $idListview)
GUICtrlCreateInput("", 20, 200, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; 允许拖动操作
GUISetState(@SW_SHOW)
GUICtrlSetData($idItem2, "条目1")
GUICtrlSetData($idItem3, "||子目 33")
GUICtrlDelete($idItem1)
; 循环到用户退出.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
MsgBox($MB_SYSTEMMODAL, "列表视图 条目", GUICtrlRead(GUICtrlRead($idListview)), 2)
Case $idListview
MsgBox($MB_SYSTEMMODAL, "列表视图", "点击 = " & GUICtrlGetState($idListview), 2)
EndSwitch
WEnd
EndFunc ;==>Example
#NoTrayIcon
#include <ButtonConstants.au3>
#include <Color.au3>
#include <ColorConstantS.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#Include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)
Example()
Func Example()
GUICreate("列表视图控件", 220, 250, 100, 200, -1, -1)
GUISetBkColor(0x00E0FFFF) ; 将改变背景颜色
Local $idListview = GUICtrlCreateListView("列 1|列 2|列 3", 10, 10, 200, 150, 0X0020)
_GUICtrlListView_SetExtendedListViewStyle($idListview,$iExListViewStyle)
Local $idPic = GUICtrlCreatePic("插入背景圖片檔案位置", 2, 2, 100, 200) ;此代碼可插入背景圖片
;MsgBox(0,"", $idPic )
Local $idButton = GUICtrlCreateButton("测试", 75, 170, 70, 20)
Local $idItem1 = GUICtrlCreateListViewItem("条目2|col22|col23", $idListview)
Local $idItem2 = GUICtrlCreateListViewItem("条目1|子目2|子目3", $idListview)
Local $idItem3 = GUICtrlCreateListViewItem("条目3|col32|col33", $idListview)
GUICtrlCreateInput("", 20, 200, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; 允许拖动操作
GUISetState(@SW_SHOW)
GUICtrlSetData($idItem2, "条目1")
GUICtrlSetData($idItem3, "||子目 33")
GUICtrlDelete($idItem1)
; 循环到用户退出.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
MsgBox($MB_SYSTEMMODAL, "列表视图 条目", GUICtrlRead(GUICtrlRead($idListview)), 2)
Case $idListview
MsgBox($MB_SYSTEMMODAL, "列表视图", "点击 = " & GUICtrlGetState($idListview), 2)
EndSwitch
WEnd
EndFunc ;==>Example yohoboy 发表于 2019-12-21 00:36
#NoTrayIcon
#include
#include
感谢,采用了 $GUI_ONTOP (2048) 控件拥有相对于窗口的置顶(Z 轴)属性.
GUICtrlSetState($idListview, 2048)
页:
[1]