Solved

How can I change the fonts in the menus?

Posted on 2001-07-19
1
223 Views
Last Modified: 2013-12-03
HI:
    Today,I met with a strange problem:No matter how I do,I cant't change the fonts in the menus.Sometimes in order to meet the need of our users,we have to enlarge the fonts of the menus,and their default font seems have been fixed.To my disappointment,there doesn't exist a property 'font' like other components in the mainmenu component.
    I also tried to enlarge the form's font so that the menu's font would change for the sake of inheritance,but
failed again.What shall I do?Hope to get your kind help.Thank you.
0
Comment
Question by:huaqiangsheng
1 Comment
 

Accepted Solution

by:
NopparatM earned 50 total points
ID: 6300941
1- Set property "OwnerDraw" of TMainMenu to True
2- write procedure of event "OnDrawItem" of TMenuItem that you want change font like this....

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    PopupMenu1: TPopupMenu;
    menu1: TMenuItem;
    test1: TMenuItem;
    procedure menu1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
      Selected: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.menu1DrawItem(Sender: TObject; ACanvas: TCanvas;
  ARect: TRect; Selected: Boolean);
begin
     With ACanvas do
       begin
            Font.Color := ClRed;
            Font.Size := 14;
            Textout(ARect.left,ARect.Top,'Test');
       end;
end;

end.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now