MSHFlexGrid1与ADODC绑定时.
数字字段(INT,SINGLE,LONG..)的名称以及该字段记录的内容都显示在单元格的右边,左边空白.
其他字段(string...)的名称以及该字段记录的内容都显示在单元格的左边,右边空白.
有没有什么办法让所有字段的名称居中显示.
数字字段(INT,SINGLE,LONG..)的名称以及该字段记录的内容都显示在单元格的右边,左边空白.
其他字段(string...)的名称以及该字段记录的内容都显示在单元格的左边,右边空白.
有没有什么办法让所有字段的名称居中显示.
Dim i As Integer
With MSHFlexGrid1
For i = 0 To .Cols - 1
.ColAlignment(i) = flexAlignCenterCenter
Next i
End With
End Sub______________________________________________________
Visual Basic: MSFlexGrid/MSHFlexGrid ControlsColAlignment, ColAlignmentBand, ColAlignmentHeader Properties (MSHFlexGrid)
Returns or sets the alignment of data in a column. This can be a standard column, a column within a band, or a column within a header. This property is not available at design time (except indirectly through the FormatString property).Syntaxobject.ColAlignment(Index) [=value]
object.ColAlignmentBand(BandNumber, BandColIndex) [=value]
object.ColAlignmentHeader(BandNumber, BandColIndex) [=value]Syntax for the ColAlignment, ColAlignmentBand, and ColAlignmentHeader properties has:Part Description
object An object expression that evaluates to an object in the Applies To list.
Index
BandNumber
Required. A Long value that specifies the number of the band in the MSHFlexGrid.
BandColIndex Required. A Long value that specifies the number of the column in the MSHFlexGrid.
value An integer or constant that specifies the alignment of data in a column, as described in Settings.
SettingsThe settings for value are:Constant Value Description
flexAlignLeftTop 0 The column content is aligned left, top.
flexAlignLeftCenter 1 Default for strings. The column content is aligned left, center.
flexAlignLeftBottom 2 The column content is aligned left, bottom.
flexAlignCenterTop 3 The column content is aligned center, top.
flexAlignCenterCenter 4 The column content is aligned center, center.
flexAlignCenterBottom 5 The column content is aligned center, bottom.
flexAlignRightTop 6 The column content is aligned right, top.
flexAlignRightCenter 7 Default for numbers. The column content is aligned right, center.
flexAlignRightBottom 8 The column content is aligned right, bottom.
flexAlignGeneral 9 The column content is of general alignment. This is "left, center" for strings and "right, center" for numbers.
ResAny column can have an alignment that is different from other columns. The ColAlignment property affects all cells in the specified column, including those in fixed rows.To set individual cell alignments, use the CellAlignment property. To set column alignments at design time, use the FormatString property.If the MSHFlexGrid is in vertical mode, the setting ColAlignment(3) may affect columns in multiple bands.
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.