Beispiel #1
0
            // update layout
            public virtual void UpdateLayout(ref int positionY, ref int tabIndex, bool needVerticalScroll)
            {
                if (VisibleDependingExpandedFlag)
                {
                    if (CreatedControl != null)
                    {
                        CreatedControl.SuspendLayout();

                        var newLocation = new Point(0, positionY);
                        //var newLocation = new Point( 0, positionY - Owner.ScrollBarPosition );

                        //var newLocation = new Point( 0, positionY - Owner.VerticalScroll.Value );

                        if (CreatedControl.Location != newLocation)
                        {
                            CreatedControl.Location = newLocation;
                        }

                        int scrollBarOffset = 0;
                        if (/*!Owner.VerticalScroll.Visible && */ needVerticalScroll)
                        {
                            scrollBarOffset = Owner.ScrollBarWidth + 1;
                        }

                        if (CreatedControl.Width != Owner.ClientSize.Width - scrollBarOffset)
                        {
                            CreatedControl.Width = Owner.ClientSize.Width - scrollBarOffset;
                        }

                        //var newLocation = new Point( 0, positionY - Owner.VerticalScroll.Value );
                        //if( CreatedControl.Location != newLocation )
                        //	CreatedControl.Location = newLocation;

                        //int scrollBarOffset = 0;
                        //if( !Owner.VerticalScroll.Visible && needVerticalScroll )
                        //	scrollBarOffset = SystemInformation.VerticalScrollBarWidth;

                        //if( CreatedControl.Width != Owner.ClientSize.Width - scrollBarOffset )
                        //	CreatedControl.Width = Owner.ClientSize.Width - scrollBarOffset;



                        UpdateControl();

                        if (!CreatedControl.Visible)
                        {
                            CreatedControl.Visible = true;
                        }
                        CreatedControl.ResumeLayout(true);

                        positionY += CreatedControl.Height;

                        if (CreatedControl.TabIndex != tabIndex)
                        {
                            CreatedControl.TabIndex = tabIndex;
                        }
                        tabIndex++;
                    }
                }
                else
                {
                    if (CreatedControl != null && CreatedControl.Visible)
                    {
                        CreatedControl.Visible = false;
                    }
                }

                foreach (var item in Children)
                {
                    item.UpdateLayout(ref positionY, ref tabIndex, needVerticalScroll);
                }
            }