Ejemplo n.º 1
0
        } // Get32BitModes

        static public void SortByAspectRatio(List <DisplayResolution> list)
        {
            // Sort to match aspect ratio of current screen resolution.
            DisplayResolution res = CurrentResolution();

            if (res.widescreen)
            {
                // Bubble non-widescreen options to top of list.
                for (int i = 0; i < list.Count - 1; i++)
                {
                    for (int j = 0; j < list.Count - 1; j++)
                    {
                        if (!list[j].widescreen && list[j + 1].widescreen)
                        {
                            // Swap
                            DisplayResolution tmp = list[j];
                            list[j]     = list[j + 1];
                            list[j + 1] = tmp;
                        }
                    }
                }
            }
            else
            {
                // Bubble widescreen options to top of list.
                for (int i = 0; i < list.Count - 1; i++)
                {
                    for (int j = i; j < list.Count - 1; j++)
                    {
                        if (list[j].widescreen && !list[j + 1].widescreen)
                        {
                            // Swap
                            DisplayResolution tmp = list[j];
                            list[j]     = list[j + 1];
                            list[j + 1] = tmp;
                        }
                    }
                }
            }
        }   // end of SortByAspectRatio()