hMailServer.Shared.TabOrderManager.TabSchemeComparer.Compare C# (CSharp) Метод

Compare() публичный Метод

public Compare ( object x, object y ) : int
x object
y object
Результат int
            public int Compare(object x, object y)
            {
                Control control1 = x as Control;
                Control control2 = y as Control;

                if( control1 == null || control2 == null )
                {
                    Debug.Assert( false, "Attempting to compare a non-control" );
                    return 0;
                }

                if( comparisonScheme == TabScheme.None )
                {
                    // Nothing to do.
                    return 0;
                }

                if( comparisonScheme == TabScheme.AcrossFirst )
                {
                    // The primary direction to sort is the y direction (using the Top property).
                    // If two controls have the same y coordination, then we sort them by their x's.
                    if( control1.Top < control2.Top )
                    {
                        return -1;
                    }
                    else if( control1.Top > control2.Top )
                    {
                        return 1;
                    }
                    else
                    {
                        return ( control1.Left.CompareTo( control2.Left) );
                    }
                }
                else    // comparisonScheme = TabScheme.DownFirst
                {
                    // The primary direction to sort is the x direction (using the Left property).
                    // If two controls have the same x coordination, then we sort them by their y's.
                    if( control1.Left < control2.Left )
                    {
                        return -1;
                    }
                    else if( control1.Left > control2.Left )
                    {
                        return 1;
                    }
                    else
                    {
                        return (control1.Top.CompareTo( control2.Top ));
                    }
                }
            }
TabOrderManager.TabSchemeComparer