Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

WindowSize property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property WindowSize: TSize;

Description

This property specifies the size of the window, in pixels, that is used to display a console application. If either dimension is zero or less then the default window size is used.

The property defaults to (0, 0).

Remarks

If a console application shares a console this property has no effect. See UseNewConsole for more information about shared consoles.

The individual fields of the property are read-only so the property must be set by first creating a TSize record containing the required window size and then assigning the record to the property. For example:

var
  Size: TSize;
  App: TPJConsoleApp;
begin
  // assume App contains a valid TPJConsoleApp instance
  Size.cx := 640;  // 640 pixels wide
  Size.cy := 480;  // 480 pixels high
  App.WindowSize := Size;
end;

The MakeSize routine has been provided to make this process easier. The following code has the same effect as the above:

var
  App: TPJConsoleApp;
begin
  // assume App contains a valid TPJConsoleApp instance
  App.WindowSize := MakeSize(640, 480);
end;

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.