CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2000
    Location
    Netherlands
    Posts
    71

    Adding pictures to MSFlexGrid

    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.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Adding pictures to MSFlexGrid

    ' 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
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured