'设置表头居中 Public Sub GridHeadCenter(Grid As MSHFlexGrid) Dim i As Integer With Grid .Redraw = False .Row = 0 For i = 0 To .Cols - 1 .Col = i .CellAlignment = flexAlignCenterCenter .CellFontBold = True Next .Redraw = True ' If .Rows > 0 Then ' .Row = 1 ' End If End With End Sub
with MSHFlexGrid .FormatString = "|^" & "表头一" & _ "|^" & "表头二" & _ "|^" & "表头N" end with
.ColAlignment(1) = flexAlignLeftCenter
.ColAlignment(2) = flexAlignLeftCenter
请问这位兄弟^符号是加在哪里呢?请给出具体句子
Public Sub GridHeadCenter(Grid As MSHFlexGrid)
Dim i As Integer
With Grid
.Redraw = False
.Row = 0
For i = 0 To .Cols - 1
.Col = i
.CellAlignment = flexAlignCenterCenter
.CellFontBold = True
Next
.Redraw = True
' If .Rows > 0 Then
' .Row = 1
' End If
End With
End Sub
.FormatString = "|^" & "表头一" & _
"|^" & "表头二" & _
"|^" & "表头N"
end with
MSHFLexgrid.FixedRows = 2
MSHFLexgrid.FixedRows = 2
然后设置固定行的对齐方式:
MSHFLexgrid.ColAlignmentFixed(1) = 4
。
。
应该这样就可以了
.FormatString = "|^" & "表头一" & _
"|^" & "表头二" & _
"|^" & "表头N"
end with
=======================================
高,不过我这里没有VB不知行不行!
ColAlignmentFixed 属性
返回或设置 MSHFlexGrid 的一列中固定单元格中的数据的对齐方式。语法object.ColAlignmentFixed(index) [=value]
lyxhappy(RosyClouds) 兄讲的我也试过了,那样搞起来实在是麻烦的不得了,而且它要从第一列开始指定,如果有很多列的话真是死定了,还有一点,它是根据如“表头一”这样的表头来自动设置列宽的,这样会把已经调整好的列宽弄得乱七八糟。
llwhr(露) 兄的乃正解