-- 回复:(有点蓝)把表格样式改为foxtable经典蓝drawce...
上楼代码只有在焦点单元格背景色为白色是,才可以显示红色边框。如果焦点单元格已有背景色,就不显示红色边框。求助,焦点单元格有背景色时,焦点单元格也能显示红色边框
如果焦点单元格样式显示背景色和字体颜色后,下面代码,焦点单元格边框没显示红色边框:
If e.Row.index = e.Table.rowsel AndAlso e.Col.name = "正式成果名称" Then
e.style = "样式1"
e.Graphics.DrawRectangle(New Pen(Color.Red,2),e.x + 1,e.y + 1, e.Width-4, e.Height - 4) \'当前表样式边框颜色设置
End If
下面代码,如果焦点单元格已有背景色及字体颜色,焦点单元格红色边框,也没显示:
Dim dr As DataRow = DataTables("单元格绘制").find("表名=\'" & e.Table.name & "\' and 列名=\'" & e.Col.name & "\' and 列值=\'" & e.Row(e.Col.name) & "\' And 停用=false")
If dr IsNot Nothing AndAlso e.Col.name = dr("列名") AndAlso e.Row(e.Col.name) = dr("列值") Then
If dr IsNot Nothing Then
Dim s As String = e.Table.name & e.Col.name & dr("列值")
\'e.Table.grid.Styles.Remove("User" & s)
e.Table.DataTable.AddUserStyle(s, Color.FromARGB(IIF(dr.Isnull("单元格颜色"),-1,dr("单元格颜色"))), Color.FromARGB(IIF(dr.Isnull("字体颜色"),-1,dr("字体颜色"))) )
e.style =s
e.Graphics.DrawRectangle(New Pen(Color.Red,2),e.x + 1,e.y + 1, e.Width-4, e.Height - 4) \'当前表样式边框颜色设置
End If
End If