2

I'm setting the main menu font (via Screen.MenuFont) to match the name/size of the font used everywhere else in the program. But the main menu doesn't refresh with the rest of the form - I have to pass the mouse over each menu item to have it repaint the item in the new font. How can I force the main menu to repaint on the change?

1 Answer 1

5

This is really easy:

Just call the DrawMenuBar function and pass the handle to the form containing the menu:

procedure TForm1.FormClick(Sender: TObject);
begin
  Screen.MenuFont.Name := 'Arial Black';
  DrawMenuBar(Handle);
end;
2
  • 2
    Maybe you could move call to DrawMenuBar to procedure CMSysFontChanged(var Message: TMessage); message CM_SYSFONTCHANGED; of TForm1.
    – Peter Wolf
    May 7, 2021 at 11:44
  • Great! Thanks! And Peter's msg method does work.
    – SteveS
    May 7, 2021 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.