MSFlexGrid控件

 

在WinCC中查询数据库,进行数据呈现时,很多时候需要用到MSFlexGrid控件。下面是控件在VBS中的一些属性设置的应用

 1 Sub SetControlProperty(ByVal Item)
 2         With Item
 3             .Redraw = False     '禁止重画,防止闪动  
 4             .BackColorFixed = RGB(190, 218, 178)     '标题行背景色  
 5             .Row = 0                   '设置标题行文字的对其方式  
 6             .Col = 0
 7             .ColSel = .Cols - 1
 8             .CellForeColor = vbBlue   '标题行文字颜色  
 9             .CellAlignment = 4       '对其方式为中间中间  
10             .ScrollTrack = True     '移动滚动条的同时数据也滚动  
11             For I = .FixedRows To .Rows - 1   '单双行表格条纹背景色显示  
12                 .Row = I                     '选择第I行  
13                 .Col = .FixedCols
14                 .ColSel = .Cols - 1
15                 If I / 2 = Int(I / 2) Then   '判断是单是双  
16                     .CellBackColor = RGB(224, 248, 224)       '双行的底色  
17                 Else
18                     .CellBackColor = RGB(240, 248, 224)       '单行的底色  
19                 End If
20             Next I
21 
22             .Row = 1
23             .Col = 1
24             .ColSel = .Cols - 1
25             .Redraw = True   '允许重画,显示表格  
26         End With
27  End Sub
View Code

 

posted @ 2020-09-01 11:19  小傻瓜的大迷糊  阅读(843)  评论(0)    收藏  举报