vsflexgrid.colformat如何使用?我设置格式好像都没用!

解决方案 »

  1.   

    Private Sub Form_Load()            ' format numbers        fg.ColFormat(1) = "#,###.##" ' number with thousand separators        fg.ColFormat(2) = "#.###%"   ' percentage        fg.ColFormat(3) = "#,.##"    ' thousands        fg.ColFormat(4) = "Currency" ' thousands            ' format booleans        fg.ColDataType(5) = flexDTBoolean        fg.ColFormat(5) = "Probably;Hardly" ' boolean            ' format dates        fg.ColFormat(6) = "ddd, mmmm d, yyyy"        fg.ColFormat(7) = "Medium Date"        fg.ColFormat(8) = "Medium Time"            ' set some cells        fg.TextMatrix(1, 1) = 1234.56        fg.TextMatrix(1, 2) = 0.5432        fg.TextMatrix(1, 3) = 125250        fg.TextMatrix(1, 4) = -1234.5        fg.TextMatrix(1, 5) = True        fg.TextMatrix(1, 6) = #7/4/1969#        fg.TextMatrix(1, 7) = #7/4/1969#        fg.TextMatrix(1, 8) = #7/4/1969#        ' display results:            Dim i%        Debug.Print "Format"; Tab(20); "Content"; Tab(40); "Display"        Debug.Print "-----------"; Tab(20); "-----------"; Tab(40); "-------------"        For i = 1 To 8              Debug.Print fg.ColFormat(i); Tab(20); _                          fg.Cell(flexcpText, 1, i); Tab(40); _                          fg.Cell(flexcpTextDisplay, 1, i)        Next    End SubThis code produces the following output:Format             Content             Display-----------        -----------         -------------#,###.##           1234.56             1,234.56#.###%             0.5432              54.320%#,.##              125250              125.25Currency           -1234.5             ($1,234.50)Probably;Hardly    True                Probablyddd, mmmm d, yyyy  04/07/1969          Fri, July 4, 1969Medium Date        04/07/1969          04-Jul-69Medium Time        04/07/1969          12:00 AM