public void Draw() { if (Height <= 0) { Height = 1; } if (Width <= 0) { Width = 1; } for (short y = 0; y < Height; ++y) { for (short x = 0; x < Width; ++x) { Win32Console.PutChar((short)(x + X), (short)(y + Y), ' ', ConsoleColor.Black, ConsoleColor.Gray); } } short sx = 0; short sy = 0; string s = Text; if (Height % 2 == 0) { sy = (short)(Height / 2); } else { sy = (short)((Height - 1) / 2); } sx = (short)((Width - Text?.Length ?? 0) / 2); if (Text.Length >= Width) { sx = 0; if (Text.Length > Width) { s = s.Substring(0, Width); } } Win32Console.PutString((short)(X + sx), (short)(Y + sy), s); }