Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            int delta = -previewButton.Width + DisplayHelper.AutoFitSystemButton(previewButton, previewButton.Width, int.MaxValue);

            videoCode.Width      -= delta;
            videoCode.RightToLeft = System.Windows.Forms.RightToLeft.No;

            if (BidiHelper.IsRightToLeft)
            {
                lblService.SizeChanged += new EventHandler(lblService_SizeChanged);
                videoCode.TextAlign     = HorizontalAlignment.Right;
            }
            else
            {
                lblSize.SizeChanged += new EventHandler(lblSize_SizeChanged);
            }

            int oldTop = pictureBorder.Top;

            pictureBorder.Top     = videoCode.Bottom + 6;
            pictureBorder.Height -= pictureBorder.Top - oldTop;

            BidiHelper.RtlLayoutFixup(this, true, true, Controls);
        }
Пример #2
0
        private void _control_Load(object sender, EventArgs e)
        {
            LayoutHelper.AutoFitLabels(_labelSize);

            DisplayHelper.AutoFitSystemLabel(_labelOne, _labelOne.Width, int.MaxValue);
            DisplayHelper.AutoFitSystemButton(_previewButton, 0, int.MaxValue);

            if (_control.RightToLeft == RightToLeft.Yes)
            {
                _webImageUrl.Left  = _previewButton.Right + (int)DisplayHelper.ScaleX(WebImageUrlPadding);
                _webImageUrl.Width = _pictureBorder.Right - _previewButton.Right - (int)DisplayHelper.ScaleX(WebImageUrlPadding);

                _fileSize.Left  = _pictureBorder.Left;
                _fileSize.Width = _labelSize.Left - _fileSize.Left - SizeLabelPadding;
            }
            else
            {
                _webImageUrl.Left  = _pictureBorder.Left;
                _webImageUrl.Width = _previewButton.Left - _webImageUrl.Left - (int)DisplayHelper.ScaleX(WebImageUrlPadding);

                _fileSize.Left  = _labelSize.Right + SizeLabelPadding;
                _fileSize.Width = _pictureBorder.Right - _fileSize.Left;
            }

            BidiHelper.RtlLayoutFixup(_control);

            _webImageUrl.Select();
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // WinLive 53092: Avoid horizontal scrolling for languages with long label names.
            int maxLabelWidth = panel1.Width;

            foreach (Control control in flowLayoutPanel.Controls)
            {
                maxLabelWidth = Math.Max(maxLabelWidth, control.PreferredSize.Width);
            }
            this.Width += maxLabelWidth - panel1.Width;

            // WinLive 52981: Avoid clipping the author combobox for languages with tall comboboxes.
            this.panelComboAuthorIsolate.Height = this.comboAuthor.PreferredSize.Height;

            DisplayHelper.AutoFitSystemButton(buttonClose);

            if (Owner != null)
            {
                this.Left = BidiHelper.IsRightToLeft
                                ? this.Owner.Left + SystemInformation.VerticalScrollBarWidth * 2
                                : this.Owner.Right - this.Width - SystemInformation.VerticalScrollBarWidth * 2;

                Top = Owner.Top + 100;
            }
        }
Пример #4
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     DisplayHelper.AutoFitSystemButton(buttonCancelForm, buttonCancelForm.Width, int.MaxValue);
     using (new AutoGrow(this, AnchorStyles.Bottom, false))
     {
         LayoutHelper.NaturalizeHeightAndDistribute(8, labelRetrievingPost, buttonCancelForm);
     }
 }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     using (new AutoGrow(this, AnchorStyles.Bottom, true))
     {
         LayoutHelper.NaturalizeHeightAndDistribute(8, labelMessage, textBoxDetails, buttonOK);
         DisplayHelper.AutoFitSystemButton(buttonOK, buttonOK.Width, Int32.MaxValue);
         buttonOK.Left = (Width / 2) - (buttonOK.Width / 2);
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Make sure that the button is the same space away from the textbox
            // after it has been resized for localization
            int gutter = btnFileOpen.Left - txtFile.Right;

            DisplayHelper.AutoFitSystemButton(btnFileOpen);
            int newGutter = btnFileOpen.Left - txtFile.Right;

            txtFile.Width += (newGutter - gutter);
        }
Пример #7
0
        protected override void OnLoad(EventArgs e)
        {
            Form owner = this.Owner;

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

            base.OnLoad(e);

            DisplayHelper.AutoFitSystemButton(buttonContinue, buttonContinue.Width, int.MaxValue);
            DisplayHelper.AutoFitSystemButton(buttonExit, buttonExit.Width, int.MaxValue);
        }
 protected override void OnLoad(EventArgs e)
 {
     if (m_progressProviderResult != DialogResult.None)
     {
         //the progress operation has already completed, so don't show the dialog.
         this.DialogResult = m_progressProviderResult;
         Close();
     }
     else
     {
         base.OnLoad(e);
         DisplayHelper.AutoFitSystemButton(cancelButton, cancelButton.Width, int.MaxValue);
     }
 }
Пример #9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!DesignMode)
            {
                LayoutHelper.NaturalizeHeightAndDistribute(8, Controls);
                linkLabelDownloadPlugins.Top = pictureBoxAddPlugin.Top + 1;
                LayoutHelper.NaturalizeHeight(linkLabelPluginName);
                DisplayHelper.AutoFitSystemRadioButton(radioButtonEnablePlugin, 0, int.MaxValue);
                DisplayHelper.AutoFitSystemRadioButton(radioButtonDisablePlugin, 0, int.MaxValue);
                radioButtonEnablePlugin.BringToFront();
                DisplayHelper.AutoFitSystemButton(buttonOptions);
            }
        }
Пример #10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            DisplayHelper.AutoFitSystemButton(buttonTargetOptions);
            // HACK: for some reason this button scales particularly inaccurately
            int extraPadding = (int)DisplayHelper.ScaleX(6);

            buttonTargetOptions.Width += extraPadding;
            buttonTargetOptions.Left  -= extraPadding;

            using (new AutoGrow(this, AnchorStyles.Bottom, false))
            {
                LayoutHelper.FitControlsBelow(3, comboBoxLinkTargets);
            }
        }
Пример #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!DesignMode)
            {
                using (new AutoGrow(groupBoxUpload, AnchorStyles.Bottom, true))
                {
                    int scaledPadding = (int)DisplayHelper.ScaleY(12);
                    LayoutHelper.NaturalizeHeight(labelDesc);
                    LayoutHelper.FitControlsBelow(scaledPadding, labelDesc);
                    DisplayHelper.AutoFitSystemButton(buttonConfigureFtp, buttonConfigureFtp.Width, int.MaxValue);

                    LayoutHelper.NaturalizeHeightAndDistribute(8, radioButtonWeblog, radioButtonFtp, buttonConfigureFtp);
                }
            }
        }
        public override void NaturalizeLayout()
        {
            MaximizeWidth(labelDesc);
            MaximizeWidth(labelDesc2);
            MaximizeWidth(labelName);
            MaximizeWidth(checkBoxSwitchToWeblog);

            DisplayHelper.AutoFitSystemButton(buttonEditWeblogSettings, buttonEditWeblogSettings.Width, int.MaxValue);

            LayoutHelper.NaturalizeHeightAndDistribute(3, labelName, textBoxWeblogName);
            LayoutHelper.NaturalizeHeightAndDistribute(3, labelDesc, labelDesc2);
            LayoutHelper.NaturalizeHeightAndDistribute(10,
                                                       new ControlGroup(labelDesc, labelDesc2),
                                                       new ControlGroup(labelName, textBoxWeblogName),
                                                       //buttonEditWeblogSettings,
                                                       checkBoxSwitchToWeblog);
        }
Пример #13
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;
            }
        }
Пример #14
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Set the font size and color for the heading
            labelHeading.Font      = Res.GetFont(FontSize.XLarge, FontStyle.Regular);
            labelHeading.ForeColor = BlueText;

            // Layout the heading and subheading
            LayoutHelper.NaturalizeHeightAndDistribute(3, labelHeading, labelSubheading);
            // Move the options panel below the subheading
            panelOptions.Top = labelSubheading.Bottom + (int)DisplayHelper.ScaleY(10);

            int width  = 0;
            int height = 0;

            foreach (ChoiceOption co in _options)
            {
                co.AdjustSize();
                width = Math.Max(co.Width, width);
                panelOptions.Controls.Add(co);
                co.Top    = height;
                height   += co.Size.Height + (int)DisplayHelper.ScaleY(5);
                co.Click += new EventHandler(co_Click);
            }

            // Set the panel width and height
            panelOptions.Width  = width + 3;
            panelOptions.Height = height;

            // Set the windows width and height
            int panelHeight = panelOptions.Top + (panelOptions.Top / 2) + panelOptions.Height;

            this.Height = panelHeight + (int)DisplayHelper.ScaleY(12) + buttonCancel.Height + (int)DisplayHelper.ScaleY(12);
            this.Width  = panelOptions.Width + panelOptions.Left + (Width - buttonCancel.Right - 1);

            // Update all the options with the max width
            foreach (ChoiceOption co in _options)
            {
                co.Width = width;
            }

            DisplayHelper.AutoFitSystemButton(buttonCancel, buttonCancel.Width, int.MaxValue);
        }
Пример #15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Bottom | AnchorStyles.Right, true))
            {
                pictureBoxLogo.Left = labelCopyright.Left;
                labelProduct.Left   = pictureBoxLogo.Right + 10;
                labelVersion.Left   = pictureBoxLogo.Right + 10;
                LayoutHelper.NaturalizeHeight(labelProduct);
                labelProduct.Top = pictureBoxLogo.Top + (pictureBoxLogo.Height / 2) - labelProduct.Height;
                LayoutHelper.DistributeVertically(15, false, labelProduct, labelVersion);
                LayoutHelper.NaturalizeHeightAndDistribute(8, labelVersion, labelCopyright);

                LayoutHelper.FitControlsBelow(10, labelCopyright);

                DisplayHelper.AutoFitSystemButton(buttonOK, buttonOK.Width, int.MaxValue);
            }
        }
Пример #16
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Right, false))
            {
                DisplayHelper.AutoFitSystemButton(buttonRestoreDefaults);
                if (buttonRestoreDefaults.Right > listBoxOptions.Right)
                {
                    int oldWidth = listBoxOptions.Width;
                    listBoxOptions.Width = buttonRestoreDefaults.Width;
                    buttonClose.Left     =
                        buttonEdit.Left  = buttonDelete.Left = buttonAdd.Left = buttonAdd.Left + listBoxOptions.Width - oldWidth;
                }

                LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Left, buttonClose.Width, int.MaxValue,
                                                      buttonAdd, buttonEdit, buttonDelete, buttonClose);
            }
        }
Пример #17
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!DesignMode)
            {
                DisplayHelper.AutoFitSystemButton(buttonUpdateStyle);
                // add some padding to the button, otherwise it looks crowded
                buttonUpdateStyle.Width += (int)Math.Ceiling(DisplayHelper.ScaleX(14));
                comboBoxRTL.Left         = buttonUpdateStyle.Left + 1;

                LayoutHelper.FixupGroupBox(groupBoxWeblogStyle);
                LayoutHelper.FixupGroupBox(groupBoxRTL);

                LayoutHelper.DistributeVertically(8, groupBoxWeblogStyle, groupBoxRTL);

                int maxWidth = groupBoxRTL.Width - comboBoxRTL.Left - 8;
                DisplayHelper.AutoFitSystemCombo(comboBoxRTL, comboBoxRTL.Width, maxWidth, false);
            }
        }
Пример #18
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new AutoGrow(this, AnchorStyles.Right, false))
            {
                using (new AutoGrow(gbTableHeader, AnchorStyles.Right, false))
                {
                    labelWordCount.AutoSize     = true;
                    labelCharsNoSpaces.AutoSize = true;
                    labelChars.AutoSize         = true;
                    labelParagraphs.AutoSize    = true;

                    LayoutHelper.AutoFitLabels(labelWordCountValue, labelCharsNoSpacesValue, labelCharsValue, labelParagraphsValue);
                }
            }

            DisplayHelper.AutoFitSystemButton(buttonClose, buttonClose.Width, int.MaxValue);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            int growth = (-btnDoAdd.Width) + DisplayHelper.AutoFitSystemButton(btnDoAdd, btnDoAdd.Width, int.MaxValue);

            if (cbParent.Visible)
            {
                growth += (-cbParent.Width) + DisplayHelper.AutoFitSystemCombo(cbParent, cbParent.Width, int.MaxValue, true);
            }

            Width      += growth;
            MinimumSize = new Size(MinimumSize.Width + growth, MinimumSize.Height);
            if (cbParent.Visible)
            {
                cbParent.Width -= growth;
            }
            else
            {
                txtNewCategory.Width -= growth;
            }

            Size preferredSize = selectorContainer.Controls[0].GetPreferredSize(Size.Empty);

            // Fix bug 611894: Category control exhibits unexpected scrolling behavior with long category names
            if (preferredSize.Width > (selectorContainer.Width + (MaximumSize.Width - Width)))
            {
                preferredSize.Height += SystemInformation.HorizontalScrollBarHeight;
            }
            preferredSize.Width += SystemInformation.VerticalScrollBarWidth;

            int deltaY = preferredSize.Height - selectorContainer.Height;
            int deltaX = preferredSize.Width - selectorContainer.Width;

            Bounds = new Rectangle(
                Left - deltaX,
                Top - deltaY,
                Width + deltaX,
                Height + deltaY
                );

            txtFilter.Select();
        }
        /// <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();
        }
Пример #21
0
        /// <summary>
        /// Override OnLoad
        /// </summary>
        /// <param name="e">event args</param>
        protected override void OnLoad(EventArgs e)
        {
            // call base
            base.OnLoad(e);

            // scale size of btnOptions based on text
            if (!_slimOptions)
            {
                int existingWidth  = btnOptions.Width;
                int preferredWidth = btnOptions.GetPreferredWidth();
                btnOptions.Left      = btnOptions.Right - preferredWidth;
                btnOptions.Width     = preferredWidth;
                textBoxAddress.Width = btnOptions.Left - 5 - textBoxAddress.Left;
            }
            else
            {
                textBoxAddress.Width = btnOptions.Right - textBoxAddress.Left;
                btnOptions.Visible   = false;

                labelRel.Visible       = false;
                comboBoxRel.Visible    = false;
                labelTitle.Visible     = false;
                textBoxTitle.Visible   = false;
                ckboxNewWindow.Visible = false;
                ckBoxGlossary.Visible  = false;
                btnAdvanced.Visible    = false;
                ClientSize             = new Size(ClientSize.Width, textBoxLinkText.Bottom + textBoxLinkText.Left);
            }

            if (btnRemove != null)
            {
                DisplayHelper.AutoFitSystemButton(btnRemove, buttonInsert.Width, int.MaxValue);
                if (btnAdvanced != null)
                {
                    btnRemove.Left = btnAdvanced.Left - btnRemove.Width - (int)Math.Round(DisplayHelper.ScaleX(8));
                }
            }

            using (new AutoGrow(this, AnchorStyles.Right, true))
            {
                LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Left, buttonInsert.Width, int.MaxValue, buttonInsert, buttonCancel);
            }

            //now, need to move the advanced button over
            if (btnAdvanced.Visible)
            {
                SetAdvancedText();
                DisplayHelper.AutoFitSystemButton(btnAdvanced, buttonInsert.Width, int.MaxValue);
                btnAdvanced.Left = buttonInsert.Right - btnAdvanced.Width;
            }

            // install auto-complete on the address text box
            int result = Shlwapi.SHAutoComplete(textBoxAddress.Handle,
                                                SHACF.URLALL | SHACF.AUTOSUGGEST_FORCE_ON);

            // ensure we installed it successfully (if we didn't, no biggie -- the user will
            // just not get autocomplete support)
            Debug.Assert(result == HRESULT.S_OK, "Unexpected failure to install AutoComplete");

            // prepopulate the text box w/ http prefix and move the cursor to the end
            if (textBoxAddress.Text == String.Empty)
            {
                try
                {
                    if (Clipboard.ContainsText())
                    {
                        string clipboardText = Clipboard.GetText();
                        if (Regex.IsMatch(clipboardText ?? "", "^https?://", RegexOptions.IgnoreCase) &&
                            UrlHelper.IsUrl(clipboardText))
                        {
                            textBoxAddress.Text = clipboardText;
                            textBoxAddress.Select(0, textBoxAddress.TextLength);
                        }
                    }
                }
                catch (ExternalException)
                {
                }
                catch (ThreadStateException)
                {
                }
            }

            if (textBoxAddress.Text == String.Empty)
            {
                textBoxAddress.Text = HTTP_PREFIX;
                textBoxAddress.Select(HTTP_PREFIX.Length, 0);
            }

            //decide whether it should be maximized
            ShowAdvancedOptions = (LinkSettings.ShowAdvancedOptions || Rel != String.Empty || LinkTitle != String.Empty) &&
                                  comboBoxRel.Visible;

            //use new window sticky setting if this isn't an edit
            if (!_editStyle)
            {
                NewWindow = LinkSettings.OpenInNewWindow;
            }
        }
Пример #22
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            RefreshParentCombo();


            if (panelAddCategory.Visible)
            {
                if (comboBoxParent.Visible)
                {
                    DisplayHelper.AutoFitSystemButton(buttonAdd);
                    using (new AutoGrow(this, AnchorStyles.Bottom | AnchorStyles.Right, false))
                    {
                        textBoxAddCategory.Width = buttonAdd.Right - textBoxAddCategory.Left;

                        DisplayHelper.AutoFitSystemCombo(comboBoxParent, 0, int.MaxValue, true);
                        comboBoxParent.Left = textBoxAddCategory.Left;
                        comboBoxParent.Top  = textBoxAddCategory.Bottom + ScaleY(3);
                        buttonAdd.Top       = comboBoxParent.Top + (comboBoxParent.Height - buttonAdd.Height) / 2;
                        buttonAdd.Left      = comboBoxParent.Right + ScaleX(3);

                        if (buttonAdd.Right > textBoxAddCategory.Right)
                        {
                            int deltaX = buttonAdd.Right - textBoxAddCategory.Right;
                            textBoxAddCategory.Width += deltaX;
                            using (LayoutHelper.SuspendAnchoring(textBoxAddCategory, buttonAdd, comboBoxParent))
                                panelAddCategory.Width += deltaX;
                            categoryContainerControl.Width += deltaX;
                        }
                        else
                        {
                            buttonAdd.Left       = textBoxAddCategory.Right - buttonAdd.Width;
                            comboBoxParent.Width = buttonAdd.Left - comboBoxParent.Left - ScaleX(3);
                        }

                        int deltaY = comboBoxParent.Bottom - textBoxAddCategory.Bottom;
                        panelAddCategory.Height      += deltaY;
                        categoryContainerControl.Top += deltaY;
                        categoryRefreshControl.Top   += deltaY;
                    }
                }
                else
                {
                    using (new AutoGrow(this, AnchorStyles.Right, false))
                    {
                        int deltaX = -buttonAdd.Width + DisplayHelper.AutoFitSystemButton(buttonAdd);
                        textBoxAddCategory.Width -= deltaX;

                        int desiredWidth = DisplayHelper.MeasureString(textBoxAddCategory, textBoxAddCategory.Text).Width + (int)DisplayHelper.ScaleX(10);
                        deltaX += desiredWidth - textBoxAddCategory.Width;
                        if (deltaX > 0)
                        {
                            panelAddCategory.Width         += deltaX;
                            categoryContainerControl.Width += deltaX;
//							textBoxAddCategory.Width += deltaX;
//							buttonAdd.Left = textBoxAddCategory.Right + ScaleX(3);
//							textBoxAddCategory.Width = Math.Max(desiredWidth, textBoxAddCategory.Width);
//							textBoxAddCategory.Width = buttonAdd.Left - textBoxAddCategory.Left - ScaleX(3);
                        }
                    }
                }

                /*using (LayoutHelper.SuspendAnchoring(comboBoxParent, buttonAdd, textBoxAddCategory, panelAddCategory, categoryContainerControl))
                 * {
                 *  if (comboBoxParent.Visible)
                 *  {
                 *      deltaW = -comboBoxParent.Width + DisplayHelper.AutoFitSystemCombo(comboBoxParent, 0, int.MaxValue, true);
                 *      buttonAdd.Left += deltaW;
                 *  }
                 *
                 *  int oldWidth = buttonAdd.Width;
                 *  DisplayHelper.AutoFitSystemButton(buttonAdd);
                 *  buttonAdd.Width += (int)DisplayHelper.ScaleX(6); // add some more "air" in the Add button
                 *  deltaW += buttonAdd.Width - oldWidth;
                 *
                 *  panelAddCategory.Width += deltaW;
                 *  categoryContainerControl.Width += deltaW;
                 *  Width += deltaW;
                 * }*/
            }

            // use design time defaults to drive dynamic layout
            _topMargin    = categoryContainerControl.Top;
            _bottomMargin = Bottom - categoryContainerControl.Bottom;

            using (new AutoGrow(this, AnchorStyles.Right, false))
                LayoutControls(_categoryContext, true, false);
            UpdateSelectedCategories(_categoryContext.SelectedCategories);

            BidiHelper.RtlLayoutFixup(this);
        }
Пример #23
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     DisplayHelper.AutoFitSystemButton(buttonEditConfiguration);
 }
Пример #24
0
        private void RefreshLayout()
        {
            if (_auth == null)
            {
                return;
            }

            SuspendLayout();
            ckBoxSavePassword.Width = Width - ckBoxSavePassword.Left - 10;
            linkLabelCreateMicrosoftAccountID.Width = Width - linkLabelCreateMicrosoftAccountID.Left - 10;
            LayoutHelper.NaturalizeHeight(pictureBoxLogo, lblUsername, txtUsername, lblEmailExample, lblPassword, txtPassword, ckBoxSavePassword, linkLabelCreateMicrosoftAccountID, linkLabelPrivacy, btnLogin);

            if (ShowCreateMicrosoftAccountID)
            {
                LayoutHelper.DistributeVertically(4, false, pictureBoxLogo, lblUsername, txtUsername, lblEmailExample, lblPassword, txtPassword, ckBoxSavePassword, linkLabelCreateMicrosoftAccountID, linkLabelPrivacy, btnLogin);
            }
            else
            {
                LayoutHelper.DistributeVertically(4, false, pictureBoxLogo, lblUsername, txtUsername, lblEmailExample, lblPassword, txtPassword, ckBoxSavePassword, btnLogin);
            }

            ckBoxSavePassword.Visible = _auth.AllowSavePassword;

            lblUsername.Width     =
                lblPassword.Width = lblEmailExample.Width = txtUsername.Width;
            lblUsername.Left      =
                lblPassword.Left  = lblEmailExample.Left = txtUsername.Left;

            if (BidiHelper.IsRightToLeft)
            {
                pictureBoxLogo.Left = txtUsername.Right - pictureBoxLogo.Width;
            }
            else
            {
                pictureBoxLogo.Left = txtUsername.Left;
            }

            Controls.Remove(lblStatus);

            DisplayHelper.AutoFitSystemButton(btnLogin, btnLogin.Width, int.MaxValue);
            LayoutHelper.FitControlsBelow(10, pictureBoxLogo);

            LayoutHelper.NaturalizeHeightAndDistribute(3, lblUsername, txtUsername, lblEmailExample);
            LayoutHelper.FitControlsBelow(10, lblEmailExample);
            if (ShowCreateMicrosoftAccountID)
            {
                LayoutHelper.NaturalizeHeightAndDistribute(3, lblPassword, txtPassword, ckBoxSavePassword);
                LayoutHelper.NaturalizeHeightAndDistribute(15, ckBoxSavePassword, new ControlGroup(linkLabelCreateMicrosoftAccountID, linkLabelPrivacy), btnLogin);
            }
            else
            {
                LayoutHelper.NaturalizeHeightAndDistribute(3, lblPassword, txtPassword, ckBoxSavePassword);
                LayoutHelper.NaturalizeHeightAndDistribute(15, ckBoxSavePassword, btnLogin);
            }

            if (BidiHelper.IsRightToLeft)
            {
                btnLogin.Left          = txtPassword.Left;
                ckBoxSavePassword.Left = txtPassword.Right - ckBoxSavePassword.Width;
                linkLabelCreateMicrosoftAccountID.Left = txtPassword.Right - linkLabelCreateMicrosoftAccountID.Width;
                linkLabelPrivacy.Left = txtPassword.Right - linkLabelPrivacy.Width;
            }
            else
            {
                btnLogin.Left          = txtPassword.Right - btnLogin.Width;
                ckBoxSavePassword.Left = linkLabelCreateMicrosoftAccountID.Left = linkLabelPrivacy.Left = txtPassword.Left;
                linkLabelCreateMicrosoftAccountID.Left -= 2;
                linkLabelPrivacy.Left -= 2;
            }

            Controls.Add(lblStatus);
            ResumeLayout();
        }
Пример #25
0
        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);
        }
Пример #26
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     DisplayHelper.AutoFitSystemButton(buttonCancelForm, buttonCancelForm.Width, int.MaxValue);
 }