Marc
  • Marc
  • Member Topic Starter
2014-03-24T17:48:24Z
Hi Igor

I would like to set an iGrid control's height the way it shows all rows, i.d. there should be no need to scroll vertically.

I tried to calculate and set the control's height as follows:

ctrl.Width = PixelsToTwips(grd.Sys(igSysRowsVisScrollHeight) + (grd.Sys(igSysClientAreaHeight) _
     - grd.Sys(igSysCellsAreaHeight)), gsaDirectionVertical) _
     + ctrl.TopPadding + ctrl.BottomPadding

PixelsToTwips() is a function to convert pixel values to Twips:
Public Function PixelsToTwips(lPixels As Long, lDirection As TScreenDirection) As Long
    Dim lngDeviceHandle As Long
    Dim lPixelsPerInch As Long
    
    lngDeviceHandle = GetDC(0) 'API function
    
    If lDirection = TScreenDirection.gsaDirectionHorizontal Then
        lPixelsPerInch = GetDeviceCaps(lngDeviceHandle, 88) 'API function
    Else
        lPixelsPerInch = GetDeviceCaps(lngDeviceHandle, 90) 'API function
    End If
    
    lngDeviceHandle = ReleaseDC(0, lngDeviceHandle) 'API function
    PixelsToTwips = lPixels * 1440 / lPixelsPerInch
End Function

The result comes close but I still seem to neglect something, i.e. I still have to scroll a bit.
Do you have any hint for me?

Thanks!
Marc

PS. I'm developing with Access 2010.
Igor/10Tec
2014-03-25T13:58:57Z
I do not see that you take into account the control border width, 2 pixels from each side for the standard 3D border.