Example #1
0
 // Set the buffer size.
 public static void SetBufferSize(int width, int height)
 {
     lock (typeof(Console))
     {
         SpecialMode();
         int wleft, wtop, wwidth, wheight;
         Stdio.GetWindowSize
             (out wleft, out wtop, out wwidth, out wheight);
         if (width <= 0 || width > 32767 || width < (wleft + wwidth))
         {
             throw new ArgumentOutOfRangeException
                       ("width", _("ArgRange_Width"));
         }
         if (height <= 0 || height > 32767 ||
             height < (wtop + wheight))
         {
             throw new ArgumentOutOfRangeException
                       ("height", _("ArgRange_Height"));
         }
         Stdio.SetBufferSize(width, height);
     }
 }
Example #2
0
 // Set the window position.
 public static void SetWindowPosition(int left, int top)
 {
     lock (typeof(Console))
     {
         SpecialMode();
         int width, height;
         Stdio.GetBufferSize(out width, out height);
         int wleft, wtop, wwidth, wheight;
         Stdio.GetWindowSize
             (out wleft, out wtop, out wwidth, out wheight);
         if (left < 0 || (left + wwidth) > width)
         {
             throw new ArgumentOutOfRangeException
                       ("left", _("ArgRange_XCoordinate"));
         }
         if (top < 0 || (left + wheight) > height)
         {
             throw new ArgumentOutOfRangeException
                       ("left", _("ArgRange_YCoordinate"));
         }
         Stdio.SetWindowSize(left, top, wwidth, wheight);
     }
 }