Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Right, false))
            {
                DisplayHelper.AutoFitSystemLabel(labelWidth, 0, int.MaxValue);
                DisplayHelper.AutoFitSystemLabel(labelPixels, 0, int.MaxValue);
                LayoutHelper.DistributeHorizontally(8, labelWidth, textBoxWidth, labelPixels);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Right | AnchorStyles.Bottom, false))
            {
                // Fix up the Size group box
                using (new AutoGrow(groupBoxSize, AnchorStyles.Right, false))
                {
                    using (new AutoGrow(panelRowsAndColumns, AnchorStyles.Right, false))
                    {
                        DisplayHelper.AutoFitSystemLabel(labelRows, 0, int.MaxValue);
                        DisplayHelper.AutoFitSystemLabel(labelColumns, 0, int.MaxValue);
                        LayoutHelper.DistributeHorizontally(8, labelRows, numericTextBoxRows);
                        LayoutHelper.DistributeHorizontally(8, labelColumns, numericTextBoxColumns);
                        LayoutHelper.DistributeHorizontally(16,
                                                            new ControlGroup(labelRows, numericTextBoxRows),
                                                            new ControlGroup(labelColumns, numericTextBoxColumns));
                    }
                }

                // Fix up the Appearance group box
                using (new AutoGrow(groupBoxAppearance, AnchorStyles.Right | AnchorStyles.Bottom, false))
                {
                    DisplayHelper.AutoFitSystemCheckBox(checkBoxShowBorder, 0, int.MaxValue);
                    DisplayHelper.AutoFitSystemLabel(label1, 0, int.MaxValue);
                    DisplayHelper.AutoFitSystemLabel(label3, 0, int.MaxValue);
                    DisplayHelper.AutoFitSystemLabel(labelBorderPixels, 0, int.MaxValue);
                    DisplayHelper.AutoFitSystemLabel(labelPaddingPixels, 0, int.MaxValue);
                    DisplayHelper.AutoFitSystemLabel(labelSpacingPixels, 0, int.MaxValue);
                    LayoutHelper.DistributeHorizontally(
                        8,
                        new ControlGroup(checkBoxShowBorder, label1, label3),
                        new ControlGroup(numericTextBoxBorder, numericTextBoxCellPadding, numericTextBoxCellSpacing),
                        new ControlGroup(labelBorderPixels, labelPaddingPixels, labelSpacingPixels)
                        );
                }

                // Make the group boxes the same width
                int maxWidth = Math.Max(groupBoxAppearance.Width, groupBoxSize.Width);
                groupBoxAppearance.Width = maxWidth;
                groupBoxSize.Width       = maxWidth;
            }

            // Align the OK/Cancel
            ControlGroup okCancelGroup = new ControlGroup(buttonOK, buttonCancel);

            okCancelGroup.Left = groupBoxAppearance.Right - okCancelGroup.Width;
            LayoutHelper.FixupOKCancel(buttonOK, buttonCancel);
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Bottom, true))
            {
                DisplayHelper.AutoFitSystemButton(buttonYes, buttonYes.Width, int.MaxValue);
                DisplayHelper.AutoFitSystemButton(buttonNo, buttonNo.Width, int.MaxValue);
                LayoutHelper.DistributeHorizontally(8, buttonYes, buttonNo);
                LayoutHelper.NaturalizeHeight(labelError, labelExplanation, cbDontShowAgain);
                LayoutHelper.DistributeVertically(12,
                                                  labelError,
                                                  labelExplanation,
                                                  new ControlGroup(buttonYes, buttonNo),
                                                  cbDontShowAgain);
                cbDontShowAgain.Left = labelError.Left;
            }
        }
        /// <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();
        }
Esempio n. 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            LayoutHelper.AutoFitLabels(label1, label2);
            LayoutHelper.DistributeHorizontally(8, label1, label2);
            LayoutHelper.DistributeHorizontally(8, textBoxWidth, textBoxHeight);
            if (label2.Left > textBoxHeight.Left)
            {
                textBoxHeight.Left = label2.Left;
            }
            else
            {
                label2.Left = textBoxHeight.Left;
            }

            textBoxWidth.Left  = label1.Left;
            textBoxHeight.Left = label2.Left;

            LayoutHelper.NaturalizeHeightAndDistribute(3, new ControlGroup(imageSizePickerControl1, buttonCustomize), new ControlGroup(label1, label2));
            LayoutHelper.NaturalizeHeightAndDistribute(3, new ControlGroup(label1, label2), new ControlGroup(textBoxHeight, textBoxWidth), cbConstrainRatio);
        }
        public override void NaturalizeLayout()
        {
            // Wizard views are very broken in the VS Form Designer, due to runtime control layout.
            if (DesignMode)
            {
                return;
            }

            MaximizeWidth(labelSubtitle);
            MaximizeWidth(labelLocalSitePath);

            LayoutHelper.DistributeHorizontally(5, textBoxLocalSitePath, btnLocalSiteBrowse);
            LayoutHelper.NaturalizeHeight(labelSubtitle);
            LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelLocalSitePath, textBoxLocalSitePath);

            // Align browse button exactly with textbox
            btnLocalSiteBrowse.Height = textBoxLocalSitePath.Height;
            btnLocalSiteBrowse.Top    = textBoxLocalSitePath.Top;

            LayoutHelper.DistributeVerticallyNoScale(20, false,
                                                     labelSubtitle,
                                                     new ControlGroup(labelLocalSitePath, textBoxLocalSitePath, btnLocalSiteBrowse)
                                                     );
        }
        protected override void OnLoad(EventArgs e)
        {
            Parent.Dock = DockStyle.Fill;

            Form form = FindForm();

            form.AcceptButton = buttonOK;
            form.CancelButton = buttonCancel;
            form.MinimumSize  = new Size(536, 320);
            form.ShowIcon     = false;
            //form.MaximizeBox = true;
            form.Closing += delegate
            {
                if (form.DialogResult == DialogResult.Cancel)
                {
                    originalState.Restore();
                    EditorContext.ApplyDecorator();
                }
                else
                {
                    // This forces the linked image to be updated as well
                    SaveSettingsAndApplyDecorator();
                }
            };

            base.OnLoad(e);

            if (EditorContext.EnforcedAspectRatio == null)
            {
                int width = cbAspectRatio.Left - lblAspectRatio.Right;

                DisplayHelper.AutoFitSystemLabel(lblAspectRatio, 0, int.MaxValue);

                DisplayHelper.AutoFitSystemCombo(cbAspectRatio, 0, int.MaxValue, false);
                buttonRotate.Width = buttonRotate.GetPreferredWidth();

                bool isButtonRotateVisible = buttonRotate.Visible;
                buttonRotate.Visible = true;
                LayoutHelper.DistributeHorizontally(width, lblAspectRatio, cbAspectRatio, buttonRotate);
                buttonRotate.Visible = isButtonRotateVisible;
                if (isButtonRotateVisible && (cbAspectRatio.Height + 2) > buttonRotate.Height)
                {
                    buttonRotate.Height = cbAspectRatio.Height + 2;
                }
            }
            else
            {
                lblAspectRatio.Visible       =
                    cbAspectRatio.Visible    =
                        buttonRotate.Visible = false;
            }

            DisplayHelper.AutoFitSystemCheckBox(chkGrid, 0, int.MaxValue);
            DisplayHelper.AutoFitSystemButton(btnRemoveCrop);
            LayoutHelper.FixupOKCancel(buttonOK, buttonCancel);
            chkGrid.Left = buttonCancel.Right - chkGrid.Width;

            panel1.Height        = Math.Max(buttonRotate.Bottom, cbAspectRatio.Bottom) + 3;
            imageCropControl.Top = panel1.Bottom;

            imageCropControl.Select();

            //int minWidth = buttonRotate.Right + width + (form.ClientSize.Width - buttonOK.Left) + SystemInformation.FrameBorderSize.Width * 2;
            //form.MinimumSize = new Size(minWidth, form.MinimumSize.Height);
        }