Blank Space comming after the last row

Posted by: soumya on 8 September 2017, 12:37 pm EST

  • Posted 8 September 2017, 12:37 pm EST

    Hi All,


       I have one issue that is when i populate a spread, and scrolled down the end, then i can see one blank space with gray color is comming after the last row. I want to remove the blank space. Anyone please help me.


    Thanks in advance.

  • Replied 8 September 2017, 12:37 pm EST

    Hi Bob,


       I am sending you the codes:


    ------------------


    Form2.vb code

    Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FpSpread1.SuspendLayout()
    adjustSpreadSize()
    FpSpread1.ResumeLayout()
    MsgBox(FpSpread1.Width & "," & FpSpread1.Height)
    End Sub

    Private Sub adjustSpreadSize()
    Dim w As New Integer, h As New Integer
    Dim c As FarPoint.Win.Spread.Column
    Dim r As FarPoint.Win.Spread.Row
    For Each c In FpSpread1.Sheets(0).RowHeader.Columns
    w = w + c.Width
    Next
    For Each c In FpSpread1.Sheets(0).Columns
    w = w + c.Width
    w = w + 1 'for gridlines
    Next
    For Each r In FpSpread1.ActiveSheet.ColumnHeader.Rows
    h = h + r.Height
    Next
    For Each r In FpSpread1.ActiveSheet.Rows
    h = h + r.Height
    h = h + 1 '
    for gridlines
    Next
    Dim hs, vs As Integer
    hs = SystemInformation.HorizontalScrollBarHeight
    vs = SystemInformation.VerticalScrollBarWidth
    FpSpread1.Width = w + vs
    FpSpread1.Height = Math.Min(h + hs, 98)
    'FpSpread1.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.Never
    End Sub
    End Class

    You can try out this for column count-3 and row count-5


     

  • Replied 8 September 2017, 12:37 pm EST

    Soumya -

    You have to size the sheet to get rid of the grayarea...

    http://www.clubfarpoint.com/Forums/forums/thread/26956.aspx
  • Replied 8 September 2017, 12:37 pm EST

    Hi Bob


    I need to show more than 1000 records in a spread with a height of 70, and i did the same thing as you suggested. as i need to set the height of the spread to 70, so i used math.min function to set the height. but the problem is not solved , one blank space is comming between the last row and the horizontal scroll bar.

  • Replied 8 September 2017, 12:37 pm EST

    I am not able to reproduce this.  Do you have a project you could attach that shows your issue?  Did you try adding the code that bobbyO supplied in the referenced post?
  • Replied 8 September 2017, 12:37 pm EST

    Hi Bob,


       I am attaching a small project, please find the same and test what I am doing wrong.


     


    2007/06/testWindiwsApp.zip
  • Replied 8 September 2017, 12:37 pm EST

    I am not able to open the zip file.  It is not in a format that my WinZip recognizes.
  • Replied 8 September 2017, 12:37 pm EST

    Soumya -

    I am not in the office at the moment to debug your code but if the height of the viewport equals the combined height of the last n rows then when you scroll all the way down you should see the last n rows with no gray area.  However, if the height of the viewport is less that the combined height of the last n rows (even by one pixel) then when you scroll all the way down you will see the last n-1 rows with some gray area.  It sounds like the height of your viewport is not evenly divisible by the height of your rows.

  • Replied 8 September 2017, 12:37 pm EST

    Hi Bob,


    As you suggested me i used the following code to set the ViewPort size:


    FpSpread1.SetViewportPreferredHeight(0, 0, h)


    FpSpread1.SetViewportPreferredWidth(0, 0, w + vs)


    But still the dblank gray space comming after the last row.


     

  • Replied 8 September 2017, 12:37 pm EST

    Soumya -

    I do not see a way to do this without all the rows being visible in the spread.  Let me see if Scott has any ideas about this.  He will be in the office later today.
  • Replied 8 September 2017, 12:37 pm EST

    Soumya -

    Here is what one of the developers had to say about the issue...

    He is making two mistakes in his code.

    First, he is adding a pixel for the grid lines when the grid lines are already included in the row heights and column widths.  Thus, he needs to remove the following lines...

        w = w + 1 'for gridlines

        h = h + 1 'for gridlines

    Second, he is forgetting about the control's border which is included in the control's Width and Height properties.  Thus, he needs to add the border size to the control's new width and height...

        Size b;
        if (fpSpread1.BorderStyle == BorderStyle.Fixed3D)
            b = SystemInformation.Border3DSize;
        else if (fpSpread1.BorderStyle == BorderStyle.FixedSingle)
            b = SystemInformation.BorderSize;
        else
            b = new Size(0,0);
        fpSpread1.Width = w + vs + 2 * b.Width;
        fpSpread1.Height = Math.Min(h + hs + 2 * b.Height, 98);

    Note that you have to double the border size since the border is on both the left and right (or top and bottom) of the control.


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels