Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I change the fonts in the menus?

Posted on 2001-07-19
1
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
NopparatM earned 150 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…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

721 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