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;

Delphi Component Messages

Posted December 15th @ 1:56 pm by m3Rlin

Delphi sends messages for notification of events that are only applicable to Delphi components. They are like Windows messages in use. If you have a component that publishes the Font property the component probably needs to be repainted if any subproperties in the Font are changed. Changing the Font property does not necessarily generate a [...]

« Previous EntriesNext Entries »