Click to See Complete Forum and Search --> : MSHFlexGrid
horrocks beach
August 29th, 2001, 03:08 AM
Can someone PLEASE tell me how to put an image into an MSHFlexGrid cell?
I have tried MSHFlexGrid1.cellpicture=loadpicture(picturename) but all I get "Compiler Error, Invalid Use Of Property"
HELP, I am going out of my mind over this.
bhanuprakash
August 29th, 2001, 04:02 AM
u please check what is the celltype property for that flexgrid or else set the cellytpe property of either celltypepic/celltypebutton and then you check should be ok
Iouri
August 29th, 2001, 07:02 AM
Sub AddPicToCell(flex As MSFlexGrid, row As Long, col As Long, pic As stdole.StdPicture)
flex.row = row
flex.col = col
Set flex.CellPicture = pic
End Sub
Private Sub Command1_Click()
AddPicToCell MSFlexGrid1, 0, 0, Picture1.Picture
End Sub
Iouri Boutchkine
iouri@hotsheet.com
Iouri
August 29th, 2001, 07:02 AM
Another example
' pictures that we want to enter to the MSFG are 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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.