Exemplo n.º 1
0
        /// <summary>
        /// Raises the Layout event.
        /// </summary>
        /// <param name="levent">A LayoutEventArgs containing the event data.</param>
        protected override void OnLayout(LayoutEventArgs levent)
        {
            // Remember if we are inside a layout cycle
            _layingOut = true;

            // Must ignore any layout caused by the AddInternal in the constructor,
            // otherwise layout processing causes the controls handle to be constructed
            // (because it tries to measure text for the headers) and so child controls
            // are not added correctly when inside a TabControl. Bonkers but true.
            if (!_ignoreLayout)
            {
                // Let base class calulcate fill rectangle
                base.OnLayout(levent);

                // Only use layout logic if control is fully initialized or if being forced
                // to allow a relayout or if in design mode.
                if (IsInitialized || _forcedLayout || (DesignMode && (_panel != null)))
                {
                    Rectangle fillRect = _layoutFill.FillRect;

                    _panel.SetBounds(fillRect.X,
                                     fillRect.Y,
                                     fillRect.Width,
                                     fillRect.Height);
                }
            }

            _layingOut = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the Layout event.
        /// </summary>
        /// <param name="levent">An EventArgs that contains the event data.</param>
        protected override void OnLayout(LayoutEventArgs levent)
        {
            // Remember if we are inside a layout cycle
            _layingOut = true;

            // Let base class calulcate fill rectangle
            base.OnLayout(levent);

            // Only use layout logic if control is fully initialized or if being forced
            // to allow a relayout or if in design mode.
            if (IsInitialized || _forcedLayout || (DesignMode && (_panel != null)))
            {
                Rectangle fillRect = _layoutFill.FillRect;
                _panel.SetBounds(fillRect.X, fillRect.Y, fillRect.Width, fillRect.Height);
            }

            _layingOut = false;
        }