请高手帮忙vsflexgrid 控件,设置背景颜色问题
小弟在使用vsflexgrid控件时,遇到一个困难,代码如下
这个过程是 从外部拖入1个excel 表格,并在xiangxi_grid(2)中显示,并判断数据库中是否有重复的数据,如果有,xiangxi_grid(2)中对应的行背景颜色就设置成其他颜色
程序运行无错误,第一次拖入excel表格 背景颜色正常变色,第二次以及后续拖入,颜色就不变了,而且能看到控件背景颜色 一闪而过,闪的是我设置的颜色,小弟对vsflexgrid控件不太熟悉,还望高手多多帮忙,谢谢了
Private Sub Label_tr1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, Y As Single) '详细信息批量导入xiangxi_grid(1).Rows = 1xiangxi_grid(2).Rows = 1Dim biaoming As StringDim cf_js As IntegerIf conn_tr.State = adStateOpen Then conn_tr.Closeconn_tr.CursorLocation = adUseClientconn_tr.Open "Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;Data Source=" & Data.Files(1) & ";Extended Properties='Excel 8.0;HDR=Yes'"Set rs_tr = conn_tr.OpenSchema(adSchemaTables)biaoming = rs_tr!TABLE_NAMErs_tr.Closers_tr.Open "select * from [" & biaoming & "]", conn_tr, adOpenDynamic, adLockOptimisticSet xiangxi_grid(2).DataSource = rs_trFor a = 0 To xiangxi_grid(2).Cols - 1 If sz_pd(a) = True Then For B = 1 To xiangxi_grid(2).Rows - 1 If xiangxi_grid(2).TextMatrix(B, a) <> "" Then If jichu_select(xiangxi_grid(2).TextMatrix(0, a), xiangxi_grid(2).TextMatrix(B, a)) = False Then If sj_pd(xiangxi_grid(2).TextMatrix(0, a), xiangxi_grid(2).TextMatrix(B, a)) = True Then xiangxi_grid(1).AddItem xiangxi_grid(2).TextMatrix(0, a) & vbTab & xiangxi_grid(2).TextMatrix(B, a) End If End If End If Next B End IfNext acf_js = 0xiangxi_grid(2).Redraw = flexRDBufferedxiangxi_grid(2).RefreshFor B = 1 To xiangxi_grid(2).Rows - 1 If xiangxi_cf(xiangxi_grid(2).TextMatrix(B, 0), xiangxi_grid(2).TextMatrix(B, 1), xiangxi_grid(2).TextMatrix(B, 3)) = True Then xiangxi_grid(2).Cell(flexcpBackColor, B, 0, B, xiangxi_grid(2).Cols - 1) = &HC0C0FF cf_js = cf_js + 1 End IfNext BIf (xiangxi_grid(1).Rows > 1) Then anniu_xx_dr1.Enabled = TrueIf cf_js = 0 Then anniu_xx_dr2.Enabled = TrueEnd Sub