怎样调整mshflexgrid控件的具体的一列的长度。

解决方案 »

  1.   

    ColWidth Property Example
    The following code sets the value of the size of the first column. If the AllowUserResizing property is True, the value changes as the user resizes Column 1.Note   If you are using the MSFlexGrid control, substitute "MSHFlexGrid1" with "MSFlexGrid1."Sub Form1_Load()
       MSHFlexGrid1.AllowUserResizing = True
    End SubSub MSHFlexGrid1_MouseUp (Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
       MSHFlexGrid1.Text = MSHFlexGrid1.ColWidth(0)
    End SubColWidth Property (MSHFlexGrid)
          Returns or sets the width of the column in the specified band, in logical twips. This property is not available at design time.Note   When using the MSFlexGrid, this property returns or sets the width of the specified column, in twips. Also, the ColWidth syntax, below, cannot be used in an MSFlexGrid due to the limitations of this control. If you are using MSFlexGrid, use the syntax: object.ColWidth(number) [= value]Syntaxobject.ColWidth(index, number) [= value]The ColWidth property syntax has these parts:Part Description 
    object An object expression that evaluates to an object in the Applies To list. 
    index A Long value that specifies which column's width to change. 
    Note   This is not applicable to the MSFlexGrid.
     
    number A Long value that specifies the band that contains the column. Optional. 
    Note   In the MSFlexGrid, this is a numeric expression that specifies the column.
     
    value A numeric expression that specifies the width of the specified column, in twips. 
    ResYou can use this property to set the width of any column at run time. For instructions on setting column widths at design time, see the FormatString property.You can set ColWidth to zero to create invisible columns, or to –1 to reset the column width to its default value, which depends on the size of the current font.When number is not specified, it defaults to 0. Hence, when the MSHFlexGrid is not bound to a hierarchical Recordset, using 0 and not specifying number both have the same result. Note that number is an optional parameter for backward compatibility with the MSFlexGrid.