'''1、序号:公用模块
Public Sub Autoxh(Form As Form, Grid As MSHFlexGrid)
Grid.TextMatrix(0, 0) = "xh" '''加序号
Dim a As Long
'For a = 1 To rs.RecordCount ' 直接写语句时,用此得序号
For a = 1 To Grid.Rows - 1 ' 调用过程查询时,用此得序号
Grid.TextMatrix(a, 0) = a '''' 加序号
Next a
End Sub
'''调用:查询后,mshflexgrid添加序号
Autoxh Me, MSHFlexGrid2 '''调用序号模块(MSHFlexGrid2,根据实际填写)
'''2、MshFlexgrid标题居中,行高, 公共模块
Public Sub hightAlignment(Form As Form, Grid As MSHFlexGrid)
'''作用:mshflexgrid标题居中,网络居中,行高
'====================MSHFlexgrid标题居中==========================
Dim m, k, j
For m = 0 To Grid.Cols - 1
Grid.ColAlignmentFixed(m) = 4 '可选1-4
Next m
'====================MSHFlexgrid标题居中==========================
'-------------------------网格(非标题)居中对齐-------------------------------
For k = 0 To Grid.Cols - 1
Grid.ColAlignment(k) = 1 '可选1-4
Next k
'-------------------------网格(非标题)居中对齐-------------------------------
'************************ 改变行高 ************************
'Dim j
With Grid
.Visible = False
For j = 1 To .Rows - 1
.RowHeight(j) = 500 '''行高
Next
.Visible = True
End With
'************************ 改变行高 ************************
End Sub
'''调用:查询后,调用模块,使MshFlexgrid
hightAlignment Me, MSHFlexGrid2 '''调用模块HighaLigment,行高,居中(MSHFlexGrid2,根据实际填写)