Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

Caption font on TLMDFloatingForm

How can I control the font used for the caption of a TLMDFloatingFont?

When a panel is undocked and turned into a TLMDFloatingForm, it seems always to use the font defined in Vcl.Graphics.DefFontData, which is Tahoma. I think this is because the ParentFont property of a TCustomForm is False by default.

I tried to find an event fired when the form is undocked that I could handle to set the font, but so far without success.

Thank you.


Comments

  • 3 Comments sorted by Votes Date Added
  • edited March 2014 Posts: 21Vote Up0Vote Down
    I just found the answer.

    1. Subclass TLMDFloatingForm, and in the constructor set up the font.
    2. Set dockPanel.FloatingDockSiteClass to the class that overrides TLMDFloatingForm.

    So when TLMDDragObject.Init creates the floating form, it creates the subclass with the customised font instead of a plain TLMDFloatingForm.

    For some reason, setting ParentFont := True in the overridden constructor isn't quite enough. You also have to call Perform(CM_PARENTFONTCHANGED, 0, 0) explicitly, because the form doesn't have a parent when it is created.
  • Thanks for your feedback!
Sign In or Register to comment.