-- 作者:jackyfashion
-- 发布时间:2017/2/18 23:11:00
-- 请教大师
各位大师:您们好!
我的ListView和数据表的互动 双击图片要很久才显示表的窗口请教大师指点
图片代码
If Tables("qrymyf").Rows.Count = 0 Then Return End If If Tables("qrymyf").current.IsNull("ltsu") = False Then Tables("qrymyf").Sort = "ltsu DESC" Dim tt As Table = Tables("yywrkhtc") Dim lt = tt(0)("khtc") & "\\" Dim lvw As WinForm.ListView = e.Sender \' lvw.StopRedraw Dim dr As DataRow = DataTables("qrymyf").dataRows(e.Index) \'根据行位置从数据表中取得对应的DataRow Dim Key As String = dr("ltsu") lvw.Images.LargeSize = New Size(100,150) lvw.Images.AddImage(Key,lt & Key & ".",lt & Key & ".") e.Row.Imagekey = key \'指定图标键值 e.Row.Tag = dr \'将DataRow赋值给ListViewRow的Tag属性,将二者联系起来 For Each cl As WinForm.ListViewColumn In lvw.Columns \'逐列取值 Select Case cl.Name Case "ffikgn","ffaa" \'如果是人口列或面积列 e.Row(cl.Name) = dr(cl.Name) \'则显示千位分割符号 Case Else e.Row(cl.Name) = dr(cl.Name) e.Row.ToolTipText = "设 计 师: " & dr("ymyfjgm") & vbcrlf & "进 度: " & dr("fjya") & vbcrlf & "发布日期: " & dr("vdmhjjad") & vbcrlf & "纸样师: " & dr("xqsujgm") & vbcrlf & "纸样进度: " & dr("xqsufjya") & vbcrlf & "车板师: " & dr("lgsrjgm") & vbcrlf & "车板进度: " & dr("lgsrfjya") & vbcrlf & "" & vbcrlf & "双击图像可以打开 款式资料 修改"& vbcrlf & "经理级别 右键单击图样后, 右击可打开 发布窗口" Dim nm As String = dr("vdmh") Dim nm2 As String = dr("pjsy") If nm = False And nm2 = False Then e.Row.ForeColor = Color.White ElseIf nm = True And nm2 = False Then e.Row.ForeColor = Color.DeepSkyBlue ElseIf nm2 = True Then e.Row.ForeColor = Color.Lime End If End Select Next \' lvw.ResumeRedraw End If
修改Button的代码:Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") Dim vr As WinForm.ListViewRow = lvw.Current \'获取ListView的当前行 If vr Is Nothing Then \'如果不存在当前行,也就是内有选定任何一行 Return Else lvw.StopRedraw Dim dr As DataRow = vr.tag \'获取此行对应的DataRow Dim ps As Integer = Tables("qrymyf").FindRow(dr) If ps >= 0 Then Tables("qrymyf").Position = ps Forms("ymyf").Open(600,150) Tables("qrymyf").Current.Locked = False vr.Retrieve() \'通知ListView,重新生成此行 lvw.ResumeRedraw End If End If
RowActivate代码:Dim btn As WinForm.Button = e.Form.Controls("Button7") btn.PerformClick()
图片达到20个,打开ymyf窗口要很久。多谢指教!
|