Dim tbl As SmGrid=Proj.CurrentSmGrid
'方法一:可以根据RuleID来重新加载图片字典数据规范即可。
tbl.Cols("ColName").SetImageMap(tbl.View.ViewCols("ColName").RuleID)
'方法二:根据SQL来生成相应的图片字典
Dim strSQL As String = "select a.Value,a.Showlext from SysDictionary a WHERE a.Class='国家'"
Dim db As Database=Proj.SysDataFactory("UserDB")
Dim dicMap As Dictionary(Of String, String) = db.GetDictionaryBySQL(Of String, String)(strSQL)
Dim lstDic As Dictionary(Of String, Image) = New Dictionary(Of String, Image)(StringComparer.OrdinalIgnoreCase)
For Each kp As KeyValuePair(Of String, String) In dicMap
'添加Key和图片(根据图片名称和固定的相对路径生成的图片)
lstDic.Add(kp.Key, ImageHelp.GetImage(kp.Value, Path.Combine(Proj.ProjectPath, "Images")))
Next
'将生成的图片字典赋值给列的ImageMap属性
tbl.Cols("ColName").ImageMap=lstDic
|