protected override void OnLoad(EventArgs e) { base.OnLoad(e); using (new AutoGrow(this, AnchorStyles.Right, false)) { DisplayHelper.AutoFitSystemLabel(labelWidth, 0, int.MaxValue); DisplayHelper.AutoFitSystemRadioButton(rbPixels, 0, int.MaxValue); DisplayHelper.AutoFitSystemRadioButton(rbPercent, 0, int.MaxValue); LayoutHelper.DistributeHorizontally(8, labelWidth, textBoxWidth, rbPixels, rbPercent); } }
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(); }
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); } }
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); } }
public void PositionControl(Control c, int indentLevel) { int INDENT_MARGIN = ScaleX(16); c.Top = _top; c.Left = _left + (INDENT_MARGIN * indentLevel); Graphics g = c.CreateGraphics(); try { int maxWidth = _maxWidth - SystemInformation.VerticalScrollBarWidth - c.Left - _left; c.Width = maxWidth; if (c is CheckBox) { DisplayHelper.AutoFitSystemCheckBox((CheckBox)c, 0, maxWidth); } else if (c is RadioButton) { DisplayHelper.AutoFitSystemRadioButton((RadioButton)c, 0, maxWidth); } else { Debug.Fail("Being asked to position a control that isn't a radiobutton or checkbox"); } LayoutHelper.NaturalizeHeight(c); } finally { g.Dispose(); } _width = Math.Max(_width, c.Width); _controls.Add(c); _top = _top + c.Height + _margin; // enforce max height if necessary if (_enforcedMaxHeight == -1 && _top > _maxHeight) { _enforcedMaxHeight = _top; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); using (AutoGrow autoGrow = new AutoGrow(this, AnchorStyles.Right, false)) { autoGrow.AllowAnchoring = true; using (new AutoGrow(groupBoxHeight, AnchorStyles.Right, false)) { DisplayHelper.AutoFitSystemRadioButton(radioButtonFixedHeight, 0, int.MaxValue); DisplayHelper.AutoFitSystemRadioButton(radioButtonSizeToContent, 0, int.MaxValue); } cellPropertiesControl.AdjustSize(); cellPropertiesControl.Width = groupBoxHeight.Width = Math.Max(cellPropertiesControl.Width, groupBoxHeight.Width); } LayoutHelper.FixupOKCancel(buttonOK, buttonCancel); }