Solved

How can I change the fonts in the menus?

Posted on 2001-07-19
1
222 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now