View Single Post
 
Old 06-02-2017, 01:19 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default Unexpected Index Change.

Could any one hint me in the right direction why the code shown below, (not every time, but once in a while) would change the index of the controls in the controlcollection?

Code:
    Public Overrides Function Layout(container As Object, layoutEventArgs As LayoutEventArgs) As Boolean
        Parent = TryCast(container, TabControl)
        If Parent IsNot Nothing Then
            For I As Integer = 0 To Parent.Controls.Count - 1
                Tp = TryCast(Parent.Controls.Item(I), TabPage)
                If Tp IsNot Nothing Then
                    With Tp
                        .Header.Bounds = New Rectangle(I * Parent.HeaderWidth.ToInteger, 0, Parent.HeaderWidth.ToInteger, Parent.HeaderHeight.ToInteger)
                        .Visible = Tp.Header.IsSelected
                    End With
                End If
            Next
        End If
        Return False
    End Function
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote