vb MSHFlexGrid如何实现这样的效果
如何固定最底下一行,滚动条拉动的时候,还显示固定的一行
[解决办法]
为你做了个mshflexgrid的最底一行固定行的例子,复制了去测试一下,可以举一反三的再增加功能。
Dim h As IntegerPrivate Sub Form_Load() With MSHFlexGrid1 .Rows = 14: .Cols = 8 .Move 0, 0 Dim i As Integer, j As Integer, he As String, r As Integer, N As Integer .FixedCols = 1: .FixedRows = 1 he = "|^xxx1|^xxx2|^xxx3|^xxx4|^xxx5|^xxx6|^xxx7|^xxx8" .FormatString = he .RowHeight(-1) = 400: .ColWidth(-1) = 800: .ColWidth(0) = 200 .Height = .RowHeight(1) * 5 + 290 + 20 .Width = .ColWidth(1) * (.Cols - 2) + 490 For i = 1 To .Rows - 2 For j = 1 To .Cols - 1 If j = 1 Then .TextMatrix(i, j) = "name" & i Else .TextMatrix(i, j) = i + j End If Next Next .Row = i: .Col = 1: .Text = "合计" For j = 1 To .Cols - 1 If j > 1 Then For r = 1 To .Rows - 2 N = N + .TextMatrix(r, j) Next .TextMatrix(r, j) = N End If .Col = j: .CellAlignment = 4 .CellBackColor = &H80FFFF: Next .RowPosition(i) = (.Height - 290) \ .RowHeight(1) - 1 h = (.Height - 290) \ .RowHeight(1) - 1 End With End SubPrivate Sub MSHFlexGrid1_Scroll() With MSHFlexGrid1 .RowPosition(h) = .TopRow + 3 h = .TopRow + 3 End WithEnd Sub