Results 1 to 3 of 3

Thread: Help with flexgrid row and column sizing

  1. #1

    Thread Starter
    Junior Member deiva's Avatar
    Join Date
    Mar 2000
    Location
    Penang, Malaysia
    Posts
    29

    Post

    Dear all,

    I am new using flexgrid. I want to be able to resize the columns and rows in flexgrid by code. How can I do it?

    Secondly, I want to use bitmap images in the grid cells. How do I address a cell in the flexgrid and put a picture into it. It was easier when I used MS Grid (GRID32.OCX) in VB4.

    I would really appeciate some help. Thank you.

    Deiva

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post

    I can help you with the first bit anyway.

    MSFlexGrid1.Colwidth(0) = 500

    The columns are indexed starting at zero so you need to reference them in brackets as shown. I'm pretty sure it's the same for height.

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    1. Here is a Generic routine I've put together a while back:
    Code:
    Public Function ResizeGrid(pGrid As MSFlexGrid, pForm As Form)
        Dim intRow As Integer
        Dim intCol As Integer
        
        With pGrid
            For intCol = 0 To .Cols - 1
                For intRow = 0 To .Rows - 1
                    If .ColWidth(intCol) < pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100 Then
                       .ColWidth(intCol) = pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100
                    End If
                Next
            Next
        End With
    End Function
    Then just call this routine like this:


    ResizeGrid MSFlexGrid1, Form1


    2. Let's say you want to put picture into the First column of the second row:

    Code:
    With MSFlexGrid1
        .Col = 0
        .Row = 1
        Set CellPicture = LoadPicture("C:\MyPicture.bmp")
    End With

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