Solved

How can I change the fonts in the menus?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
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…

821 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