Archive

Posts Tagged ‘size’

How to Determine the Screen Resolution

December 15th, 1999 m3Rlin No comments

There are two ways to determine the screen’s height and width.

1) Use the global Screen variable.

uses
  Forms;
...
  Screen.Height { Screen height in pixels }
  Screen.Width  { Screen width in pixels  }
...

2) Use the Windows API GetSystemMetrics() function. This function can be useful in applications that don’t use the VCL like console applications.

uses
  Windows;
...
  GetSystemMetric(SM_CXSCREEN) { Screen height in pixels }
  GetSystemMetric(SM_CYSCREEN) { Screen width in pixels  }
...

How to Stretch an Icon

December 15th, 1999 m3Rlin 1 comment

Although Delphi’s StretchDraw() function should work for icons it doesn’t :-) The way to get round this is to use the Windows API DrawIconEx() function.

(* iNewWidth  - (Integer) New icon width
** iNewHeight - (Integer) New icon height
*)
DrawIconEx(Canvas.Handle, 0, 0, Icon.Handle, iNewWidth, iNewHeight, 0, 0, DI_NORMAL);