Align Form Controls to Bottom - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:Control

Description

Align Form Controls to Bottom

Demo Code

// Copyright (c) .NET Foundation. All rights reserved.
using System.Windows.Forms;
using System;/*from w w w.j  a  v a2 s . c  o m*/

public class Main{
        public static void AlignBottom(params Control[] controls)
        {
            int maxBottom = int.MinValue;
            foreach (Control c in controls)
            {
                maxBottom = Math.Max(maxBottom, c.Bottom);
            }

            foreach (Control c in controls)
            {
                c.Top = maxBottom - c.Height;
            }
        }
}

Related Tutorials