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(); }
private void RefreshLayout() { sidebarHeaderControl1.RefreshLayout(); LayoutHelper.FitControlsBelow(0, sidebarHeaderControl1); DisplayHelper.AutoFitSystemLabel(linkLabelCustomizeMap, linkLabelCustomizeMap.Width, linkLabelCustomizeMap.Width); LayoutHelper.NaturalizeHeightAndDistribute(8, linkLabelCustomizeMap, new ControlGroup(labelCaption, textBoxCaption)); LayoutHelper.FitControlsBelow(20, textBoxCaption); LayoutHelper.NaturalizeHeightAndDistribute(3, labelMargins, comboBoxMargins, panelCustomMargins); }
protected override void OnLoad(EventArgs e) { using (new AutoGrow(this, AnchorStyles.None, false)) { DisplayHelper.AutoFitSystemLabel(label1, label1.Width, label1.Width); LayoutHelper.DistributeVertically(8, label1, newFolderName, new ControlGroup(buttonOK, buttonCancel)); LayoutHelper.FixupOKCancel(buttonOK, buttonCancel); } base.OnLoad(e); }
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); } }
public static int AutoFitLabels(params Label[] labels) { ControlGroup cg = new ControlGroup(labels); int startWidth = cg.Width; foreach (Label label in labels) { DisplayHelper.AutoFitSystemLabel(label, 0, int.MaxValue); } return(cg.Width - startWidth); }
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); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // size form (set anchor properties here because doing so in the designer causes // hosage of the designer) // listBoxPostSources.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom ; // listBoxPosts.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom ; // Size = PostEditorSettings.OpenPostFormSize ; LayoutHelper.FixupOKCancel(buttonOK, buttonCancel); DisplayHelper.AutoFitSystemLabel(labelShow, 0, int.MaxValue); //DisplayHelper.AutoFitSystemCombo(comboBoxPosts, 0, int.MaxValue, false); DisplayHelper.AutoFitSystemLabel(labelPosts, 0, int.MaxValue); DisplayHelper.AutoFitSystemRadioButton(radioButtonPosts, 0, int.MaxValue); DisplayHelper.AutoFitSystemRadioButton(radioButtonPages, 0, int.MaxValue); int growBy = GetMaxWidth() - listBoxPosts.Right; if (growBy > 0) { Width += growBy; listBoxPosts.Width += growBy; } // post sources list listBoxPostSources.Initialize(_includeDrafts); listBoxPostSources.SelectedIndexChanged += new EventHandler(listBoxPostSources_SelectedIndexChanged); // number of posts combo comboBoxPosts.SelectedIndexChanged += new EventHandler(comboBoxPosts_SelectedIndexChanged); // post list listBoxPosts.Initialize(this); listBoxPosts.SelectedIndexChanged += new EventHandler(listBoxPosts_SelectedIndexChanged); listBoxPosts.PostsRefreshed += new EventHandler(listBoxPosts_PostsRefreshed); listBoxPosts.DoubleClick += new EventHandler(listBoxPosts_DoubleClick); buttonDelete.Height = comboBoxPosts.Height + 2; textBoxFilter.Width = listBoxPosts.Width; int inset = Convert.ToInt32((textBoxFilter.Height - filterPictureBox.Height) / 2f); filterPictureBox.Top = textBoxFilter.Top + inset; filterPictureBox.Left = textBoxFilter.Right - 16 - inset; // select post source SelectInitialPostSource(); }
private void RefreshLayout() { //DisplayHelper.AutoFitSystemLabel(labelQueryStatus, int.MinValue, int.MaxValue); //Width = buttonPreviousPage.Width + buttonNextPage.Width + labelQueryStatus.Width + 3*PADDING_X; buttonNextPage.Top = 0; buttonPreviousPage.Top = 0; if (BidiHelper.IsRightToLeft) { DisplayHelper.AutoFitSystemLabel(labelQueryStatus, int.MinValue, int.MaxValue); buttonNextPage.Left = 0; buttonPreviousPage.Left = buttonNextPage.Right + PADDING_X; labelQueryStatus.Left = buttonPreviousPage.Right + PADDING_X; } else { buttonNextPage.Left = Width - buttonNextPage.Width; buttonPreviousPage.Left = buttonNextPage.Left - buttonPreviousPage.Width - PADDING_X; labelQueryStatus.Left = buttonPreviousPage.Left - labelQueryStatus.Width - PADDING_X; labelQueryStatus.TextAlign = ContentAlignment.MiddleRight; } }
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) { 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); }