AGS.Editor.Utilities.CheckLabelWidthsOnForm C# (CSharp) Метод

CheckLabelWidthsOnForm() публичный статический Метод

public static CheckLabelWidthsOnForm ( Control parentControl ) : void
parentControl System.Windows.Forms.Control
Результат void
        public static void CheckLabelWidthsOnForm(Control parentControl)
        {
            foreach (Control child in parentControl.Controls)
            {
                CheckLabelWidthsOnForm(child);

                if (child is Label)
                {
                    if (child.Right > parentControl.ClientRectangle.Right)
                    {
                        //System.Diagnostics.Trace.WriteLine("Control: " + child.ToString() + " X: " + child.Left + "  ParentRight: " + parentControl.ClientRectangle.Right);
                        //System.Diagnostics.Trace.WriteLine("MaxSize was: " + child.MaximumSize.ToString() + "; size was: " + child.Size.ToString());
                        if (child.MaximumSize.Width > 0)
                        {
                            child.MaximumSize = new Size(parentControl.ClientRectangle.Right - child.Left - 10, 0);
                        }
                        else
                        {
                            child.Size = new Size(parentControl.ClientRectangle.Right - child.Left - 10, child.Height);
                        }
                        //System.Diagnostics.Trace.WriteLine("MaxSize now: " + child.MaximumSize.ToString() + "; size now: " + child.Size.ToString());
                    }
                }
            }
        }

Usage Example

Пример #1
0
 public WizardDialog(string wizardName, string introText, List <WizardPage> pages)
 {
     InitializeComponent();
     this.Text                 = wizardName;
     this.lblTitle.Text        = "Welcome to the " + wizardName + " Wizard";
     this.lblIntroText.Text    = introText;
     this.lblHeader1.Text      = wizardName;
     this.pnlMainPages.Visible = false;
     this.btnBack.Enabled      = false;
     _pageNumber               = 0;
     _pages = pages;
     Utilities.CheckLabelWidthsOnForm(this);
 }
All Usage Examples Of AGS.Editor.Utilities::CheckLabelWidthsOnForm