Creating a GUI: Calculating the screen size - CosmosOS/Cosmos GitHub Wiki

(Completely backed by research that was done during the making of the System Shell)

Calculating the screen size is quite difficult, for there are no Height and Width properties on the canvas. We'll have to go through the mode instead.

using CGS = Cosmos.System.Graphics;
namespace Cosmos.System
{
    public static class DisplaySizeManager
    {
        public int Height
        {
            get
            {
                return Canvas.Mode.Rows;
            }
        }
        public int Width
        {
            get
            {
                return Canvas.Mode.Columns;
            }
        }
        public CGS.Canvas Canvas
        {
            get;
            set;
        }
    }
}