摘抄自己以前写的一段代码展示如何在visualfreebasic里使用mctrlgrid.
Sub Form1_Shown(hWndForm As hWnd,UserData As Integer) Dim hdr(3) As String={"中","日","俄","欧"} Dim arr(1,3) As String={{"a","b","c","d"},{"h","i","j","k"}} With Me.mCtrlGrid1 .ReSize(4, 3) For i As Integer = LBound(arr, 2) To UBound(arr, 2) .SetCell(i,MC_TABLE_HEADER,hdr(i)) For j As Integer=LBound(arr) To UBound(arr) .SetCell(i, j, arr(j,i)) Next j Next i '.SetColumnWidth(0,MC_TABLE_HEADER) End With End Sub
代码效果看图,基本就可以理解上面代码的意思了。