/// <summary>
        /// Raises the Load event.
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            //	Call the base class's method so that registered delegates receive the event.
            base.OnLoad(e);

            //  The Collection Settings dialog looks weird when it comes up with Fields
            //  selected but Flags focused... both boxes are blue. This makes sure that
            //  doesn't happen.
            this.buttonCancel.Focus();

            AdjustHeightToFit();

            using (new AutoGrow(this, AnchorStyles.Right, true))
            {
                LayoutHelper.EqualizeButtonWidthsHoriz(AnchorStyles.Right, buttonCancel.Width, int.MaxValue,
                                                       buttonOK, buttonCancel, buttonApply);

                int oldSize = sideBarControl.Width;
                sideBarControl.AdjustSize();
                int deltaX = sideBarControl.Width - oldSize;
                new ControlGroup(panelPreferences, buttonOK, buttonCancel, buttonApply).Left += deltaX;

                if (buttonOK.Left < sideBarControl.Right)
                {
                    int right = buttonApply.Right;
                    DisplayHelper.AutoFitSystemButton(buttonOK);
                    DisplayHelper.AutoFitSystemButton(buttonCancel);
                    DisplayHelper.AutoFitSystemButton(buttonApply);
                    LayoutHelper.DistributeHorizontally(8, buttonOK, buttonCancel, buttonApply);
                    new ControlGroup(buttonOK, buttonCancel, buttonApply).Left += right - buttonApply.Right;
                }
            }

            //	We're initialized, so remove all unselected panels.  This allows AutoScale to
            //	work.
            initialized = true;
            RemoveUnselectedPanels();

            // protect against being shown directly on top of an identically sized owner
            OffsetFromIdenticalOwner();
        }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            // sync top-most state (in case we are running in Deskbar)
            Form owner = this.Owner;

            if (owner != null)
            {
                this.TopMost = owner.TopMost;
            }

            // save a reference to the system menu
            _hSystemMenu = User32.GetSystemMenu(Handle, false);
            Trace.Assert(_hSystemMenu != IntPtr.Zero);

            base.OnLoad(e); // This needs to be called before _controller.OnWizardLoad so that scaling happens before the panel is added. (bugs 599809, 606698)

            _controller.OnWizardLoad();

            LayoutHelper.EqualizeButtonWidthsHoriz(AnchorStyles.Right, buttonCancel.Width, int.MaxValue,
                                                   buttonBack, buttonNext, buttonCancel);
        }