找回密码
 加入
搜索
查看: 5837|回复: 20

[网络通信] 学弄了一个ListView表增行的效果,就是有点瑕疵,这种情况有没有办法处理?[已解决]

[复制链接]
发表于 2020-5-11 18:07:36 | 显示全部楼层 |阅读模式
本帖最后由 cqboyqx 于 2020-5-15 21:02 编辑

学弄了一个ListView表增行的效果,可是就是有点瑕疵,就是当行数增加到10行及以上的时候,ListView表界面就闪跳,增加行数越多越严重,不知道这种情况有没有办法处理?
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>


Global $hListView
_Main()

Func _Main()
$Form1 = GUICreate("Form1", 740, 610)
$hListView = GUICtrlCreateListView("cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|", 8, 8, 722, 28)
GUISetState()
   ; 循环直到用户退出
   tianjia()
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc


Func tianjia()
        For $x =0 To 26
         Local $aItems[1][9]
            For $iI = 0 To 0
                        $aItems[$iI][0] = 'text'&$x
                $aItems[$iI][1] = 'text'&$x
                $aItems[$iI][2] = 'text'&$x
                $aItems[$iI][3] = 'text'&$x        
                                $aItems[$iI][4] = 'text'&$x
                $aItems[$iI][5] = 'text'&$x
                $aItems[$iI][6] = 'text'&$x
                $aItems[$iI][7] = 'text'&$x
                                $aItems[$iI][8] = 'text'&$x        
                        Next
                        
                        Sleep(500)
                 _GUICtrlListView_AddArray($hListView, $aItems)
                     $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
                         _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 8, 722, $iY-17, $SWP_NOZORDER)                                                  
        Next
EndFunc


发表于 2020-5-11 20:51:00 | 显示全部楼层
Func tianjia1()
        For $i = 0 To 26
                _GUICtrlListView_AddItem($hListView, 'text' & $i, $i)
                For $j = 0 To 9
                        _GUICtrlListView_AddSubItem($hListView, $i, 'text' & $i, $j)
                Next
        Next
        $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
        _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 8, 722, $iY-17, $SWP_NOZORDER)
EndFunc

Func tianjia2()
        Local $aItems[26][9]
        For $i = 0 To 26 - 1
                For $j = 0 To 9 - 1
                        $aItems[$i][$j] = 'text' & $i
                Next
        Next
        _GUICtrlListView_AddArray($hListView, $aItems)
        $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
        _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 8, 722, $iY-17, $SWP_NOZORDER)
EndFunc

发表于 2020-5-11 21:00:15 | 显示全部楼层

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>


Global $hListView
_Main()

Func _Main()
        $Form1 = GUICreate("Form1", 740, 610)
        $hListView = GUICtrlCreateListView("", 8, 8, 722, 28);cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|
        _GUICtrlListView_AddColumn($hListView, "cos_text1", 0, 2);设置列属性
        _GUICtrlListView_AddColumn($hListView, "cos_text2", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text3", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text4", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text5", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text6", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text7", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text8", 80, 2)
        _GUICtrlListView_AddColumn($hListView, "cos_text9", 80, 2)
        GUISetState()
        ; 循环直到用户退出
        tianjia()
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>_Main
Func tianjia()
        Local $iI = 0
        For $x = 0 To 26
                Local $aItems[1][9]
                For $iI = 0 To 0
                        $aItems[$iI][0] = 'text' & $x
                        $aItems[$iI][1] = 'text' & $x
                        $aItems[$iI][2] = 'text' & $x
                        $aItems[$iI][3] = 'text' & $x
                        $aItems[$iI][4] = 'text' & $x
                        $aItems[$iI][5] = 'text' & $x
                        $aItems[$iI][6] = 'text' & $x
                        $aItems[$iI][7] = 'text' & $x
                        $aItems[$iI][8] = 'text' & $x
                        $iI += 1
                Next
                _GUICtrlListView_AddArray($hListView, $aItems)
                ;Sleep(500)
        Next
        $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
        _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 8, 722, $iY - 17, $SWP_NOZORDER)
EndFunc   ;==>tianjia


 楼主| 发表于 2020-5-11 21:45:27 来自手机 | 显示全部楼层
繁星 发表于 2020-5-11 20:51

我想表达的意思不是一下子所有行的数据全部写进去,而是每间隔1-2秒时间写入一行,就是想怎么处理才能让每写进一行数据列表不闪跳
 楼主| 发表于 2020-5-11 21:47:21 来自手机 | 显示全部楼层
chzj589 发表于 2020-5-11 21:00
[au3]
#include
#include

我想表达的意思不是一下子所有行的数据全部写进去,而是每间隔1-2秒时间写入一行,就是想怎么处理才能让每写进一行数据列表不闪跳
发表于 2020-5-11 22:06:10 | 显示全部楼层

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
Global $hListView
_Main()
Func _Main()
        $Form1 = GUICreate("Form1", 740, 610)
        $hListView = GUICtrlCreateListView("cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|", 8, 8, 722, 600);cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|
        GUISetState()
        ; 循环直到用户退出
        tianjia()
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>_Main
Func tianjia()
        Local $iI = 0, $y = 26
        Local $aItems[$y][9]
        For $x = 1 To $y;-1
                $aItems[$iI][0] = 'text' & $x
                $aItems[$iI][1] = 'text' & $x
                $aItems[$iI][2] = 'text' & $x
                $aItems[$iI][3] = 'text' & $x
                $aItems[$iI][4] = 'text' & $x
                $aItems[$iI][5] = 'text' & $x
                $aItems[$iI][6] = 'text' & $x
                $aItems[$iI][7] = 'text' & $x
                $aItems[$iI][8] = 'text' & $x
                GUICtrlCreateListViewItem($aItems[$iI][0] & "|" & $aItems[$iI][1] & "|" & $aItems[$iI][2] & "|" & $aItems[$iI][3] & "|" & $aItems[$iI][4] & "|" & $aItems[$iI][5] & "|" & $aItems[$iI][6] & "|" & $aItems[$iI][7] & "|" & $aItems[$iI][8], $hListView)
                Sleep(500)
                $iI += 1
        Next
EndFunc   ;==>tianjia


 楼主| 发表于 2020-5-11 22:16:53 来自手机 | 显示全部楼层
也只有这种把列表的高度设置一步到位,如果每增加一行,列表就增加一行的高度,估计难控制闪跳。
 楼主| 发表于 2020-5-11 22:18:36 来自手机 | 显示全部楼层
chzj589 发表于 2020-5-11 22:06
[au3]
#include
#include

也只有这种把列表的高度设置一步到位,如果每增加一行,列表就增加一行的高度,估计难控制闪跳。
发表于 2020-5-11 22:35:48 | 显示全部楼层
$LVS_EX_DOUBLEBUFFER
发表于 2020-5-11 22:44:54 | 显示全部楼层
cqboyqx 发表于 2020-5-11 22:18
也只有这种把列表的高度设置一步到位,如果每增加一行,列表就增加一行的高度,估计难控制闪跳。

这样试试

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
Global $hListView
_Main()
Func _Main()
        $Form1 = GUICreate("Form1", 780, 610)
        $hListView = GUICtrlCreateListView("cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|", 8, 8, 752, 28, $LVS_REPORT, $WS_EX_CLIENTEDGE);,$LVS_EX_DOUBLEBUFFER);cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|
        _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP))
        GUISetState()
        ; 循环直到用户退出
        tianjia()
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>_Main
Func tianjia()
        Local $iI = 0, $y = 26
        Local $aItems[$y][9]
        For $x = 1 To $y;-1
                $aItems[$iI][0] = 'text' & $x
                $aItems[$iI][1] = 'text' & $x
                $aItems[$iI][2] = 'text' & $x
                $aItems[$iI][3] = 'text' & $x
                $aItems[$iI][4] = 'text' & $x
                $aItems[$iI][5] = 'text' & $x
                $aItems[$iI][6] = 'text' & $x
                $aItems[$iI][7] = 'text' & $x
                $aItems[$iI][8] = 'text' & $x
                GUICtrlCreateListViewItem($aItems[$iI][0] & "|" & $aItems[$iI][1] & "|" & $aItems[$iI][2] & "|" & $aItems[$iI][3] & "|" & $aItems[$iI][4] & "|" & $aItems[$iI][5] & "|" & $aItems[$iI][6] & "|" & $aItems[$iI][7] & "|" & $aItems[$iI][8], $hListView)
                Sleep(100)
                $iI += 1
                $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
                _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 8, 722, $iY - 17, $SWP_NOZORDER)
        Next
EndFunc   ;==>tianjia


 楼主| 发表于 2020-5-11 22:59:38 来自手机 | 显示全部楼层
chzj589 发表于 2020-5-11 22:44
这样试试
[au3]
#include

好多了,谢谢大佬
 楼主| 发表于 2020-5-11 23:00:35 来自手机 | 显示全部楼层
繁星 发表于 2020-5-11 22:35
$LVS_EX_DOUBLEBUFFER

你这个是怎么用?
 楼主| 发表于 2020-5-12 09:11:55 | 显示全部楼层

对  加上你这个就可以了   厉害拉   兄弟
 楼主| 发表于 2020-5-12 11:38:20 | 显示全部楼层
chzj589 发表于 2020-5-11 22:44
这样试试
[au3]
#include

大佬,列表扩展样式加了$WS_EX_CLIENTEDGE确实能处理闪跳问题   但是加了后出现新的问题了   如果在框架里有bat和背景图的情况下,他们就不兼容了。(没有加列表扩展样式之前,列表加入数据的时候闪跳,加扩展样式后,闪跳没有了 ,但出现列表与图片控件交叠 了)


#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>


Global $hListView
_Main()

Func _Main()
$Form1 = GUICreate("Form1", 740, 610)
$Tab1 = GUICtrlCreateTab(5, 5, 585, 49)
$TabSheet1 = GUICtrlCreateTabItem("tab1")
GuiCtrlSetState(-1,$GUI_ONTOP)
GUICtrlCreateTabItem("")
    $Pic1 = GUICtrlCreatePic(@ScriptDir & "\bmp\LOGObjt.bmp", 15, 90, 700, 500)
   GuiCtrlSetState(-1,$GUI_DISABLE)
$hListView = GUICtrlCreateListView("cos_text1|cos_text2|cos_text3|cos_text4|cos_text5|cos_text6|cos_text7|cos_text8|cos_text9|", 8, 65, 722, 100, $LVS_REPORT, $WS_EX_CLIENTEDGE)
GuiCtrlSetState(-1,$GUI_ONTOP)
GUISetState()
   ; 循环直到用户退出
  ; tianjia()
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc


Func tianjia()
        Local $iI = 0, $y = 15
        Local $aItems[$y][9]
        For $x = 1 To $y;-1
                $aItems[$iI][0] = 'text' & $x
                $aItems[$iI][1] = 'text' & $x
                $aItems[$iI][2] = 'text' & $x
                $aItems[$iI][3] = 'text' & $x
                $aItems[$iI][4] = 'text' & $x
                $aItems[$iI][5] = 'text' & $x
                $aItems[$iI][6] = 'text' & $x
                $aItems[$iI][7] = 'text' & $x
                $aItems[$iI][8] = 'text' & $x
                GUICtrlCreateListViewItem($aItems[$iI][0] & "|" & $aItems[$iI][1] & "|" & $aItems[$iI][2] & "|" & $aItems[$iI][3] & "|" & $aItems[$iI][4] & "|" & $aItems[$iI][5] & "|" & $aItems[$iI][6] & "|" & $aItems[$iI][7] & "|" & $aItems[$iI][8], $hListView)
                Sleep(200)
                $iI += 1
                $iY = _GUICtrlListView_ApproximateViewHeight($hListView)
                _WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 8, 65, 722, $iY +4, $SWP_NOZORDER)
        Next
EndFunc   ;==>tianjia




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2020-5-12 11:58:28 | 显示全部楼层
建議 搜尋一下  千萬數據 不卡頓的做法
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 17:57 , Processed in 0.080562 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表