MSHFlexGrid的例子吧。 窗体里面放一个MSHFlexGrid控件 c:\temp.bmp是一个16*16的小图片 Option Explicit Dim LastRow As Integer Private Sub Form_Load() With MSHFlexGrid1 .Rows = 5 .Cols = 5 .TextMatrix(0, 0) = "C1" .TextMatrix(0, 1) = "C1" .TextMatrix(0, 2) = "C2" .TextMatrix(0, 3) = "C3" .TextMatrix(0, 4) = "C4" Dim i As Integer Dim j As Integer For i = 0 To 4 .Col = i .Row = 0 .CellBackColor = &H8000000F .CellAlignment = 4 Next .SelectionMode = flexSelectionByRow .FixedRows = 0 .MergeCells = flexMergeRestrictRows .MergeRow(0) = True .ColWidth(0) = 300 .HighLight = flexHighlightAlways For j = 1 To 4 .TextMatrix(j, 1) = Space(3) & "test" & Str(j) Next For j = 1 To 4 .Col = 1 .Row = j Set .CellPicture = LoadPicture("c:\temp.bmp") Next End With LastRow = 1 End Sub Private Sub MSHFlexGrid1_Click() With MSHFlexGrid1 If .Row = 0 Then Exit Sub .TextMatrix(.Row, 0) = "★" If LastRow <> .Row Then .TextMatrix(LastRow, 0) = "" LastRow = .Row End If End With End Sub |