protected override void OnLoad(EventArgs e) { base.OnLoad(e); DisplayHelper.AutoFitSystemCombo(_comboBoxLanguage, _comboBoxLanguage.Width, _groupBoxGeneralOptions.Width - _comboBoxLanguage.Left - 8, false); LayoutHelper.FixupGroupBox(8, _groupBoxGeneralOptions); }
public HtmlStylePicker(IHtmlEditorCommandSource commandSource) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); styleComboBox.AccessibleName = Res.Get(StringId.TextStyle); this.AccessibleName = Res.Get(StringId.TextStyle); this.AccessibleRole = System.Windows.Forms.AccessibleRole.ComboBox; _commandSource = commandSource; this.toolTip.SetToolTip(this.styleComboBox, Res.Get(StringId.ChangeTextStyle)); this.SetStyles(defaultStyles); using (new AutoGrow(this, AnchorStyles.Right, true)) DisplayHelper.AutoFitSystemCombo(styleComboBox, 0, int.MaxValue, false); }
private void RearrangeControls() { if (!Visible) { return; } // This width depends on the contents of the combo, which are dynamic DisplayHelper.AutoFitSystemCombo(comboBoxPosts, 0, int.MaxValue, false); int HPADDING = GetHpadding(); int x; // a x = labelShow.Right + HPADDING; // b comboBoxPosts.Left = x; x = comboBoxPosts.Right + HPADDING; // c if (labelPosts.Visible) { labelPosts.Left = x; } else { panelType.Left = x; int x1 = 0; radioButtonPosts.Left = x1; x1 = radioButtonPosts.Right + HPADDING; radioButtonPages.Left = x1; // x1 = radioButtonPages.Right + HPADDING; panelType.Width = radioButtonPages.Right; } BidiHelper.RtlLayoutFixup(panelType); buttonDelete.Left = textBoxFilter.Right - buttonDelete.Width; }
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); } }
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(); }
public static void AdjustSizes(params TableAlignmentControl[] controls) { int maxCaptionWidth = 0; int maxComboWidth = 0; foreach (TableAlignmentControl c in controls) { maxCaptionWidth = Math.Max(maxCaptionWidth, DisplayHelper.AutoFitSystemLabel(c.labelCaption, 0, int.MaxValue)); maxComboWidth = Math.Max(maxComboWidth, DisplayHelper.AutoFitSystemCombo(c.comboBoxValue, 0, int.MaxValue, false)); } foreach (TableAlignmentControl c in controls) { c.comboBoxValue.Left = c.labelCaption.Left + maxCaptionWidth + (int)DisplayHelper.ScaleX(8); c.comboBoxValue.Width = maxComboWidth; if (c.Width < c.comboBoxValue.Right) { c.Width = c.comboBoxValue.Right + 1; } } }
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); }
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); }