Results 1 to 3 of 3

Thread: msh flexgrid problem

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    3

    msh flexgrid problem

    Hi,
    I am new to this forum.
    I have a problem with mshFlexgrid. I want to handle the resize column and row, in example, when the user release the mouse button after resizing a column, i need to know the new size of the column exactly when the user release the button.
    I need this info because i have a few text boxes over it, just to enter some data and i need to resize the text box controls to the size of the cell but i couldnt find the event or handle it in anyway.

    Also, is there a way to know if the scroll bar is visible at a moment, lets say, the user have 5 rows, so no scroll bar is visible, but when it reaches 10 a scroll bar will be automatically be visible and i just want to know if there is an "EASY" way, like a flag, to know this.

    Thanks for anyhelp.

  2. #2
    Member
    Join Date
    Oct 2001
    Posts
    51
    With regards the second question there is no ScrollBarVisible property or anything like that.

    You can use the ColIsVisible or RowIsVisible property to poll rows and cols to see if they are visible. But that is not 100% accurate because some rows are counted as visible when they are half on and half off the page.

    I use this code to do it for rows and a similar 2 procedures to do it for cols.

    Good Luck

    Justin

    Const m_SCROLLBARSIZE = 225

    Private Function intHScrollBarSize() As Integer
    Dim i As Long
    Dim lngSizeTotal As Long

    For i = 0 To msfGrid.Cols - 1
    lngSizeTotal = lngSizeTotal + msfGrid.ColWidth(i)
    Next i


    If lngSizeTotal + m_SCROLLBARSIZE >= msfGrid.Width And msfGrid.Cols > 1 Then
    intHScrollBarSize = m_SCROLLBARSIZE
    Else
    intHScrollBarSize = 0
    End If

    End Function


    Private Function blnRowIsVisible(ByVal lngRow As Long) As Boolean
    With msfGrid

    If Not .RowIsVisible(lngRow) Then
    Exit Function
    End If


    If .RowPos(lngRow) + .RowHeight(lngRow) >= .Height - intHScrollBarSize Then

    Exit Function
    End If

    End With

    blnRowIsVisible = True


    End Function

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    3
    thanks!
    although this isnt the exact code i wanted , it guided me to the right one and everything runs perfect now!.

    just in case i post the code i used to know if the horizontal scroll bar is visible.

    Dim i As Long
    Dim lngSizeTotal As Long

    With Grid
    lngSizeTotal = 0
    For i = .Left To .Cols - 1
    If .ColIsVisible(i) Then
    lngSizeTotal = lngSizeTotal + .ColWidth(i)
    Else
    HScrollIsVisible = True
    Exit Function
    End If
    Next i
    ' *** must include (4 * Screen.TwipsPerPixelX) , because there are 4 pixels for the border style, 2 on each side ***
    If lngSizeTotal >= .Width - (4 * Screen.TwipsPerPixelX) And .Cols > 1 Then
    HScrollIsVisible = True
    Else
    HScrollIsVisible = False
    End If
    End With


    thanks again.
    this code can be changed for the vertical scroll bar, but i do not programmed it yet...

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