Solved

How can I change the fonts in the menus?

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

11 Experts available now in Live!

Get 1:1 Help Now