How to Determine the Screen Resolution

Posted December 15th @ 9:14 pm by m3Rlin

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 [...]

How to Detect Font and Text Sizes

Posted December 15th @ 2:01 pm by m3Rlin

When creating components you may want to know when the user changed the font or text. This can be quite easily done using the CM_FONTCHANGED and CM_TEXTCHANGED messages.

TComponent1 = class(TComponent)

private

procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;

procedure TComponent1.CMTextChanged(var Message:TMessage);
begin

end;
procedure TComponent1.CMFontChanged(var Message:TMessage);
begin

end;

« Previous Entries