The function "DisplayModes" enumerates all display modes that your current
graphics card/driver supports and returns the results collected in an
"IDisplayModes" object. This interface has only the own property "Items",
with which you can access all list items, and the own method "Item", with
which you can look for a specific display mode. See also the
IDisplayModes Reference.
 |
type IDisplayModes = interface (ICustomBasicList) ['{00BED965-C78D-11D3-A530-00005A180D69}'];
function DisplayModes : IDisplayModes;
property IDisplayModes. Items [index : integer] : IDisplayMode;
function IDisplayModes. Item (width : integer;
height : integer;
bitsPerPixel : integer) : IDisplayMode;
ShowMessage('The graphics card supports ' + IntToStr(DisplayModes.ItemCount) + ' modes.');
|
|
Then we have the interface "IDisplayMode" (see also the
IDisplayMode Reference). You can get an instance of this interface
through the IDisplayModes enumeration object, or by calling the
function "DisplayMode", which directly looks for a specific display mode.
Finally you can also ask for the current display mode.
 |
type IDisplayMode = interface (IBasic) ['{00BED964-C78D-11D3-A530-00005A180D69}'];
function DisplayMode (width : integer;
height : integer;
bitsPerPixel : integer;
refreshRate : integer = 0) : IDisplayMode;
function CurrentDisplayMode : IDisplayMode;
|
|
The 3 properties "Width", "Height" and "BitsPerPixel" are the parameters,
which define a display mode. The property "NoOfColors" is only a different
presentation of the "BitsPerPixel" value.
 |
property IDisplayMode. Width : integer;
property IDisplayMode. Height : integer;
property IDisplayMode. BitsPerPixel : integer;
property IDisplayMode. NoOfColors : integer;
|
|
A display mode can also have some additional informations. But most drivers
don't support (fill) these parameters:
 |
property IDisplayMode. RefreshRate : integer;
function IDisplayMode. IsInterlaced : boolean;
function IDisplayMode. IsGrayScale : boolean;
|
|
The "Install" method installs the display mode, which is represented by the
current "IDisplayMode" object. There are several flags that you can set.
Some behave differently with different graphics cards/drivers, so you have
to try a bit, until you find the best combination for your purposes. The
"updateRegistry" parameter determines, whether the newly installed display
mode should survive system reboot.
Some display modes on some graphics cards/drivers can only be installed
with a reboot of the system. You can ask this information with the
"IsRestartNecessary" method.
 |
function IDisplayMode. IsRestartNecessary : boolean;
type TDisplayModeInstallResult = (dmOk, dmRestart, dmError);
function IDisplayMode. Install (failIfRestartNecessary : boolean = true;
fullScreen : boolean = true;
updateRegistry : boolean = false;
forAllUsers : boolean = false) : TDisplayModeInstallResult;
DisplayMode(800, 600, 16).Install;
|
|
The following function restores the display mode, which is stored in the
registry. This works only, if you installed the display mode without the
flag "updateRegistry", and even then it does not work on all graphics
cards/drivers. So if you want to go the secure way, you should better ask
the old display mode and store it in a private registry key yourself before
installing a new one. This way you can go back manually.
 |
function RestoreDisplayMode (dontResizeOtherWindows : boolean = false) : TDisplayModeInstallResult;
|
|