Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 5

Project MENUIMG

Project Structure


MENUIMG.DPR

program MenuImg;

uses
  Forms,
  MenuImgF in 'MenuImgF.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

MENUIMGF.PAS

unit MenuImgF;

interface

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

type
  TForm1 = class(TForm)
    ImageList1: TImageList;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    New1: TMenuItem;
    Close1: TMenuItem;
    Help1: TMenuItem;
    About1: TMenuItem;
    Memo1: TMemo;
    LargeFont1: TMenuItem;
    procedure New1Click(Sender: TObject);
    procedure Close1Click(Sender: TObject);
    procedure About1Click(Sender: TObject);
    procedure LargeFont1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.New1Click(Sender: TObject);
begin
  Memo1.Lines.Clear;
end;

procedure TForm1.Close1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.About1Click(Sender: TObject);
begin
  ShowMessage ('Menu Images demo'#13 +
    'from "Mastering Delphi" by Marco Cantý');
end;

procedure TForm1.LargeFont1Click(Sender: TObject);
begin
  if Memo1.Font.Size = 8 then
    Memo1.Font.Size := 12
  else
    Memo1.Font.Size := 8;
  // changes the image style near the item
  LargeFont1.Checked := not LargeFont1.Checked;
end;

end.

MENUIMGF.DFM

object Form1: TForm1
  Left = 192
  Top = 107
  Width = 356
  Height = 216
  Caption = 'Menu Images'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Menu = MainMenu1
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Memo1: TMemo
    Left = 8
    Top = 8
    Width = 337
    Height = 153
    Lines.Strings = (
      'Memo1')
    TabOrder = 0
  end
  object ImageList1: TImageList
    Left = 128
    Top = 56
    Bitmap = {
      3608000004000000424D36080000000000003604000028000000400000001000
      0000010008000000000000040000000000000000000000010000000000000000
      0000000080000080000000808000800000008000800080800000C0C0C000C0DC
      C000F0CAA6000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      00000000000000000000000000000000000000000000F0FBFF00A4A0A0008080
      80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
      000000000000FB000000000000FB000000000000000000000000000000000000
      00000000000000000000000000000000000000000000000000000000000000FB
      FB00F8F8F8FBFBF8F8F8F8FBFB0000000001FBFBFBFBFBFBFBFB000000000000
      000000FFF8F9F8FF000000000000000000000000000000000000000000000000
      FB00000000000000000000FB00000000000101FBFBFBFBFBFBFB000000000000
      00FBFFFBF9F9F9FBFFFB00000000000000000000000000000000000000000000
      0000FFFFFFFFFFFFFFFF00F80000000000010101FBFBFBFBFBFB000000000000
      FBFFFBFFF8F9F8FFFBFFFB000000000000000000000000000000000000000000
      0000FFFFFFFFFFFFFFFF00F8000000000001010100FBFBFBFBFB0000000000FB
      FFFBFFFBFFFBFFFBFFFBFFFB0000F800000000F8000000000000000000000000
      0000FFFFFFFFFFFFFFFF00F8000000000001010100FBFBFBFBFB0000000000FF
      FBFFFBFFFBF9FBFFFBFFFBFF00000000000000000000F80000000000F8000000
      0000FFFFFFFFFFFFFFFF00F8000000000001010100FBFBFBFBFB00000000FFFB
      FFFBFFFBFFF9F8FBFFFBFFFBFF0000000000F80000000000000000000000FBFB
      FB00FFFFFFFFFFFFFFFF00FBFB0000000001010100FBFBFBFBFB00000000FBFF
      FBFFFBFFFBF9F9FFFBFFFBFFFB0000F80000F8000000000000000000000000FB
      FB00FFFFFFFFFFFFFFFF00FBFBFB00000001010100FBFBFBFBFB00000000FFFB
      FFFBFFFBFFFBF9F9FFFBFFFBFF00000000000000000000F8000000F800000000
      0000FFFFFFFF000000000000000000000001010100FBFBFBFBFB00000000FBFF
      FBFFF8F8FBFFF8F9F9FFFBFFFB00000000F80000000000000000000000000000
      0000FFFFFFFF00FFFF0000000000000000010101FB00FBFBFBFB00000000FFFB
      FFFBF9F9FFFBF8F9F9FBFFFBFF0000000000F9F900F900000000000000000000
      0000FFFFFFFF00FF00FB0000000000000001010100FBFBFBFBFB0000000000FF
      FBFFF9F9F8FFF8F9F9FFFBFF0000000000000000F9F9F9000000F80000000000
      0000FFFFFFFF000000FBFB00000000000001010100FBFBFBFBFB0000000000FB
      FFFBFFF9F9F9F9F9FFFBFFFB0000000000000000F9F9F9F90000000000000000
      FB000000000000000000FBFB000000000001FE0100FBFBFBFBFB000000000000
      FBFFFBFFF9F9F9FFFBFFFB0000000000000000000000000000000000000000FB
      FB00000000FBFB00000000FBFB0000000001FEFE00FBFBFBFBFB000000000000
      00FBFFFBFFFBFFFBFFFB0000000000000000000000000000000000000000FB00
      0000000000FB00000000000000FB000000000000000000000000000000000000
      000000FFFBFFFBFF00000000000000000000000000000000000000000000424D
      BE000000000000003E0000002800000040000000100000000100010000000000
      800000000000000000000000020000000000000000000000FFFFFF00FF7EC007
      FFFFFFFF9001C007F83FFFFFC003C007E00F2030E003C007C0077379E003C007
      80030379E003C0078003A701E003C0070001A7B30001C007000187B38000C007
      0001CF93E007C0070001CFC7E00FC0070001F2C7E00FC0078003FC67E027C007
      8003FC2FC073C007C007FFFF9E79C007E00FFFFF7EFEC007F83FFFFF}
  end
  object MainMenu1: TMainMenu
    Images = ImageList1
    Left = 64
    Top = 56
    object File1: TMenuItem
      Caption = '&File'
      object New1: TMenuItem
        Caption = '&New'
        ImageIndex = 0
        OnClick = New1Click
      end
      object LargeFont1: TMenuItem
        Caption = '&Large Font'
        ImageIndex = 3
        ShortCut = 16454
        OnClick = LargeFont1Click
      end
      object Close1: TMenuItem
        Caption = 'E&xit'
        ImageIndex = 1
        ShortCut = 32883
        OnClick = Close1Click
      end
    end
    object Help1: TMenuItem
      Caption = '&Help'
      object About1: TMenuItem
        Caption = '&About...'
        ImageIndex = 2
        OnClick = About1Click
      end
    end
  end
end