Click to See Complete Forum and Search --> : Adding pictures to MSFlexGrid


webnetworks
April 3rd, 2001, 07:28 AM
Hi,

I want to add pictures (.ico files) to a specific cell in my grid.

When I use this code:

MSFlexGrid1.Col = x
MSFlexGrid1.Row = y
MSFlexGrid1.Picture = LoadPicture("image.ico", vbLPSmall, vbLPVGAColor)




I receive an Compile Error: Invalid use of property. So, I must be doing something wrong ;-)

Question is what and how should I add pictures to my grid?

Thanks in advance,

Jeroen.

Iouri
April 3rd, 2001, 08:08 AM
' we have images, that we want to enter to the MSFG on the form (imgItems)
Private Sub Form_Load()
'------------------------
Const NUM_ROWS = 10
Dim i As Integer

flxItems.Rows = NUM_ROWS
flxItems.Cols = 2
flxItems.FixedRows = 0
flxItems.FixedCols = 0
flxItems.GridLines = flexGridNone
flxItems.SelectionMode = flexSelectionByRow
flxItems.RowHeightMin = imgItems(0).Height + _
ScaleY(2, vbPixels, vbTwips)
flxItems.ColWidth(0) = flxItems.RowHeightMin
flxItems.Width = flxItems.ColWidth(0) + flxItems.ColWidth(1) + 400
flxItems.Clear
For i = 1 To NUM_ROWS
flxItems.Row = i - 1
flxItems.Col = 0
Set flxItems.CellPicture = imgItems(CInt(Rnd * 5)).Picture
flxItems.TextMatrix(i - 1, 1) = "Item " & Format$(i - 1)
Next i
End Sub


Iouri Boutchkine
iouri@hotsheet.com