Weird preferred height (size) bug

Posted by: kbj on 25 September 2018, 9:02 am EST

    • Post Options:
    • Link

    Posted 25 September 2018, 9:02 am EST

    Using the current version of the control, the below simplified vb program hangs for reasons I cannot fathom.

    Imports FarPoint.Win.Spread.Model

    Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load

    Dim ws = FpSpread1.ActiveSheet

    Dim dm = New myModelsData

    dm.RowCount = 3

    dm.ColumnCount = 1

    ws.Models.Data = dm

    ws.Rows(1).Font = New Font(“Arial”, 22)

    Dim h = ws.Rows(1).GetPreferredHeight

    End Sub

    End Class

    Public Class myModelsData

    Inherits DefaultSheetDataModel

    End Class

    When you figure this out please let me know . . . and send me back the 50 hours of my life it took me to track it down ; }

    -Kingman

  • Posted 25 September 2018, 9:59 pm EST

    Hello Kingman,

    I tested the issue with the latest version of Spread version 11.45.20183.0 using VS 2017 on Windows 10 X 64 bit machine and my application was successfully run without any hangs.

    Hence, we request you to please test the case with the latest version which can be downloaded from this link:-

    https://www.grapecity.com/en/download/spreadnet

    And if it still hangs on your machine then please share your Spread version and exact machine configuration and architecture. We will test the case at our end.

    Hope it helps.

  • Posted 26 September 2018, 12:48 am EST

    The upgrade from 11.40.20177.0 to SP2 fixed it! 11.40.20177.0 seems to be the problem.

    This brings my next question, is it possible to override GetPreferredSize on a renderer that inherits .from FlatRowHeaderRenderer?

    Much thanks for your quick response on the hanging problem.

  • Posted 27 September 2018, 10:39 pm EST

    Hello,

    Could you please clarify that why do you want to override GetPreferredSize on a renderer?

    Do you want to changes size retrieved from the GetPreferredSize?

    Please confirm.

    Thanks,

    Reeva

  • Posted 29 September 2018, 7:06 am EST

    Hi Reeva,

    Since I am doing some complicated formatting of the row header,I use a renderer that wraps the FlatRowHeaderRenderer as per Sean’s recommendation. Simply overriding GetPreferredSize doesn’t work since (for some reason) it is never called.

    The problem is not solved for me by wrapping the FlatRowHeaderRenderer since the IRenderer interface provides the string value of the rowHeader.Cell(row,column).value, not the actual object during the Implements IRenderer.GetPreferredSize function. With the Implements IRenderer.PaintCell function, the actual object is provided. The cell values I use are objects that contain not only the text for the header, but also additional formatting information.

    
     Public Function IRenderer_GetPreferredSize(g As Graphics,
                                                   size As Size,
                                                   appearance As FarPoint.Win.Spread.Appearance,
                                                   value As Object,'[b]<===< This is a string[/b]
                                                   zoomFactor As Single) As Size Implements IRenderer.GetPreferredSize
      Private Sub IRenderer_PaintCell(g As Graphics,
                                        r As Rectangle,
                                        appearance As FarPoint.Win.Spread.Appearance,
                                        value As Object,,'[b]<===< This is the cell value object[/b]
                                        isSelected As Boolean,
                                        isLocked As Boolean,
                                        zoomFactor As Single) Implements IRenderer.PaintCell
        
       
    
  • Posted 3 October 2018, 4:50 pm EST

    Hello,

    Can you please share a small working sample replicating the issue and so that we can investigate this issue further. Please upload a small zipped sample. We will debug the issue at our end and provide you with a fix.

    Thanks,

    Reeva

Need extra support?

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

Learn More

Forum Channels