Cannot scroll rows

Posted by: lakki on 8 September 2017, 1:21 pm EST

  • Posted 8 September 2017, 1:21 pm EST

    Hello,


    I have a custom control that houses spread(created and added dynamically), a vertical scroll bar and 2 horizontal scroll bars. One horizontal scroll bar scrolls the columns(all columns in each spread should scroll simultaneously) and the other horizontal scroll bar scrolls the spread controls. Vertical scroll bar which should scroll rows(all rows in every spread should scroll simultaneously). {To be simple, I want the spread controls to have a common vertical and horizontal scroll bar}. To accomplish this task, I place spread controls in a panel and change the panel location in scroll event of one of the horizontal scroll bar. To scroll rows and columns, I use SetViewportLeftColumn and SetViewportTopRow in the corresponding scroll event. Since, I wont be knowing the number of spread controls that I need to display, I create Spread controls at runtime and add them to the panel. First 2 columns of the spread are frozen. VericalScrollBar and HorizontalScrollBar property of every scroll bar is set to none.


    And the problem is,


    I cannot scroll beyond the first row and also horizontal sroll behaves strangely. Please look into attachment for reference.


    Thank you,


    Lakki


     


     


     


    2008/07/CommonSpreadControl.zip
  • Replied 8 September 2017, 1:21 pm EST

    Lakki,


    You are not setting the ViewportLeftColumn or TopRow back to 0. You are always adding a constant to this value. Is there a reason for this? Try the following code instead.


    Private Sub hsSpdCol_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsSpdCol.Scroll


    For Each ctrlSpd As Control In Me.pnlSpd.Controls


    CType(ctrlSpd, FarPoint.Win.Spread.FpSpread).SetViewportLeftColumn(0, Me.hsSpdCol.Value)


    Next


    End Sub


    Private Sub vsSpdRow_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles vsSpdRow.Scroll


    For Each ctrlSpd As Control In Me.pnlSpd.Controls


    CType(ctrlSpd, FarPoint.Win.Spread.FpSpread).SetViewportTopRow(0, Me.vsSpdRow.Value) ' + 1)


    Next


    End Sub

Need extra support?

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

Learn More

Forum Channels