protected override void OnLoad(EventArgs e)
        {
            // call base
            base.OnLoad(e);

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

            // install auto-complete on the address text box
            int result = Shlwapi.SHAutoComplete(txtURL.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 (txtURL.Text == String.Empty)
            {
                txtURL.Text = HTTP_PREFIX;
            }
            txtText.Focus();

            if (!string.IsNullOrEmpty(comboBoxRel.Rel) || !string.IsNullOrEmpty(txtTitle.Text))
            {
                RefreshAdvancedState(true);
            }
        }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            int gap = buttonAdd.Left - listViewWeblogs.Right;

            LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Right, buttonDelete.Width, int.MaxValue,
                                                  buttonAdd, buttonEdit, buttonDelete, buttonView);
            listViewWeblogs.Width = buttonAdd.Left - gap - listViewWeblogs.Left;
        }
Пример #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!DesignMode)
            {
                LayoutHelper.NaturalizeHeightAndDistribute(8, Controls);
                linkLabelMoreAboutLiveClipboard.Top = pictureBoxLiveClipboardIcon.Top + 1;

                LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Right, buttonChange.Width, int.MaxValue, buttonChange, buttonOptions);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            LayoutHelper.NaturalizeHeight(lblDescription);
            LayoutHelper.FitControlsBelow(8, lblDescription);
            int origButtonWidth = button1.Width;

            LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Right, origButtonWidth, int.MaxValue, button1, button2);
            int deltaX = button1.Width - origButtonWidth;

            listViewPlugins.Width -= deltaX;

            listViewPlugins.ItemChecked += listViewPlugins_ItemChecked;
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            int distance = radioButtonDown.Left - radioButtonUp.Right;

            DisplayHelper.AutoFitSystemRadioButton(radioButtonDown, 0, int.MaxValue);
            DisplayHelper.AutoFitSystemRadioButton(radioButtonUp, 0, int.MaxValue);
            radioButtonDown.Left = radioButtonUp.Right + distance;

            using (new AutoGrow(this, AnchorStyles.Bottom | AnchorStyles.Right, false))
            {
                int oldTop = radioButtonDown.Top;
                radioButtonDown.Top       = radioButtonUp.Top = Res.DefaultFont.Height + 3;
                groupBoxDirection.Height += Math.Max(radioButtonDown.Top - oldTop, 0);
                LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Left, buttonClose.Width, int.MaxValue, buttonFindNext, buttonClose);
            }
        }
Пример #6
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);
            }
        }
Пример #7
0
        /// <summary>
        /// Override on-load
        /// </summary>
        /// <param name="e">event args</param>
        protected override void OnLoad(EventArgs e)
        {
            /*
             *          int originalWidth = buttonIgnore.Width;
             *          int maxWidth = originalWidth;
             *          foreach (Button button in buttons)
             *              if (button.Visible)
             *                  maxWidth = Math.Max(maxWidth, DisplayHelper.AutoFitSystemButton(button));
             *          foreach (Button button in buttons)
             *              if (button.Visible)
             *                  button.Width = maxWidth;
             *          Width += maxWidth - originalWidth;
             */

            // call base
            base.OnLoad(e);

            if (wordRangeHighlightPending)
            {
                wordRange.Highlight(offset, length);
                wordRangeHighlightPending = false;
            }

            Button[] buttons =
            {
                buttonIgnore,
                buttonIgnoreAll,
                buttonChange,
                buttonChangeAll,
                buttonAdd,
                buttonCancel
            };

            using (new AutoGrow(this, AnchorStyles.Right, true))
            {
                listBoxSuggestions.Height = buttonCancel.Bottom - listBoxSuggestions.Top;

                LayoutHelper.EqualizeButtonWidthsVert(AnchorStyles.Left,
                                                      buttonIgnore.Width,
                                                      int.MaxValue,
                                                      buttons);
            }
        }
Пример #8
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;
            }
        }