以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 内存不足 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=64378) |
-- 作者:freeants -- 发布时间:2015/2/12 13:15:00 -- 内存不足 建立 listview 的时候, 提示 不是每次都提示,重新运行一次,就没有问题了。 |
-- 作者:freeants -- 发布时间:2015/2/12 13:16:00 -- listview 里面显示的是图片 |
-- 作者:freeants -- 发布时间:2015/2/12 13:18:00 -- 代码如下 Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") Dim tb As Table = e.Form.Controls("Table1").Table Dim icon As Icon lvw.StopRedraw lvw.Groups.Clear() \'清除原来的分组 lvw.Columns.Clear() \'清除原来的列 lvw.Rows.Clear() \'清除原来的行 lvw.Images.Clear() \'清除原来的图片 lvw.View = ViewMode.LargeIcon \'用大图标模式 lvw.Images.LargeSize = New Size(48,48) lvw.AutoResizeColumns() \'lvw.View = ViewMode.Details \'设置显示模式为详细内容 \'lvw.GridLines = True \'显示网格线 If FileSys.DirectoryExists(ProjectPath & e.Form.name) FileSys.DeleteDirectory(ProjectPath & e.Form.Name,2,2) End If FileSys.CreateDirectory(ProjectPath & e.Form.Name) \'////////////////////设置图片////////////////// For Each r As Row In tb.Rows Select Case r("类型") Case "文件夹" lvw.Images.AddLargeImage("文件夹",ProjectPath & "Images\\1064.ico") Case ".jpg" \'lvw.Images.AddLargeImage(r("文件全名"),r("文件全名")) lvw.Images.AddLargeImage(r("_identify"),r("文件全名")) Case Else Dim nm As String = r("类型").TrimStart(".") If FileSys.FileExists(ProjectPath & e.Form.name & "\\" & nm & ".png") Then lvw.Images.AddLargeImage(r("类型"),ProjectPath & e.Form.name & "\\" & nm & ".png") Else icon = System.Drawing.Icon.ExtractAssociatedIcon(r("文件全名")) icon.ToBitmap().Save(ProjectPath & e.Form.name & "\\" & nm & ".png") lvw.Images.AddLargeImage(r("类型"),ProjectPath & e.Form.name & "\\" & nm & ".png") End If End Select Next Dim Multi As String = tb.DataTable.GetComboListString("类型") Dim Values() As String Values = Multi.split("|") For Index As Integer = 0 To Values.Length - 1 Dim lvwg As WinForm.ListViewGroup = lvw.Groups.Add() lvwg.Name= Values(Index) lvwg.text =Values(Index).TrimStart(".") Dim filter As String = iif(tb.filter > "", tb.filter , "1=1") For Each dr As DataRow In tb.DataTable.Select( "(" & Filter & ") And 类型 = \'" & Values(Index) & "\'" ) Dim it As WinForm.ListViewRow =lvw.Rows.Add() it.Text = dr("名称") it.name = dr("文件全名") it.Group = Values(Index) \'归纳分组 Select Case dr("类型") Case "文件夹" it.ImageKey = "文件夹" Case ".jpg" it.ImageKey = dr("_identify") \' dr("文件全名") Case Else it.ImageKey = dr("类型") End Select it.Font = New Font("Noto Sans S Chinese Regular",8, FontStyle.regular) \'it.ToolTipText = dr("功能概述") Next Next lvw.ResumeRedraw |
-- 作者:Bin -- 发布时间:2015/2/12 14:05:00 -- 图片太大了,弄小一点吧 或者个弄一些缩略图. |
-- 作者:有点甜 -- 发布时间:2015/2/12 14:16:00 -- 1,图片太大、图片太多
2,分别注释掉部分代码,看是哪里出问题 |