CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MSHFlexGrid

  1. #1
    Join Date
    Aug 2001
    Posts
    3

    MSHFlexGrid

    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.






  2. #2
    Join Date
    Aug 2001
    Posts
    26

    Re: MSHFlexGrid

    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


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

    Re: MSHFlexGrid

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

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

    Re: MSHFlexGrid

    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
    [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