コード例 #1
0
            public virtual void Dispose()
            {
                foreach (var child in Children.ToArray())
                {
                    child.Dispose();
                }
                Children.Clear();

                if (CreatedControl != null)
                {
                    if (CreatedControl.Parent != null)
                    {
                        CreatedControl.Parent.Controls.Remove(CreatedControl);
                    }
                    CreatedControl.Dispose();
                    CreatedControl = null;
                }
            }
コード例 #2
0
            public virtual void CreateControl()
            {
                if (CreatedControl == null)
                {
                    try
                    {
                        // disable layout optimization
                        KryptonToolkitSettings.DisableLayout = true;
                        CreatedControl = CreateControlImpl();
                    }
                    catch (Exception)
                    {
                        //TODO: this is not fatal, we can disable item and show message.
                        throw;
                    }
                    finally
                    {
                        KryptonToolkitSettings.DisableLayout = false;
                    }

                    Owner.ContentPanel.Controls.Add(CreatedControl);

                    CreatedItemsCount++;

                    unsafe
                    {
                        unchecked
                        {
                            CreatedControlsCount += CreatedControl.GetTotalControlsCount();
                        }
                    }
                }

                foreach (var item in Children)
                {
                    item.CreateControl();
                }
            }
コード例 #3
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);
                }
            }