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 6

Chapter 10 - Project MdiMulti

Project Structure

MdiMulti.dpr
program MdiMulti;

uses
  Forms,
  Frame in 'Frame.pas' {MainForm},
  Child in 'Child.pas' {CircleChildForm},
  Child2 in 'Child2.pas' {BounceChildForm};

{$R *.RES}

begin
  Application.CreateForm(TMainForm, MainForm);
  Application.Run;
end.
Frame.pas
unit Frame;

interface

uses
  Windows, Classes, Graphics, Forms, Messages,
  Controls, Child, Child2, Menus, SysUtils, Dialogs,
  ExtCtrls, StdActns, ActnList;

type
  TMainForm = class(TForm)
    MainMenu1: TMainMenu;
    Window1: TMenuItem;
    New1: TMenuItem;
    File1: TMenuItem;
    N1: TMenuItem;
    Exit1: TMenuItem;
    Cascade1: TMenuItem;
    Tile1: TMenuItem;
    ArrangeIcons1: TMenuItem;
    New2: TMenuItem;
    Tile2: TMenuItem;
    CloseAll1: TMenuItem;
    Count1: TMenuItem;
    Image1: TImage;
    ActionList1: TActionList;
    WindowArrange1: TWindowArrange;
    WindowCascade1: TWindowCascade;
    WindowClose1: TWindowClose;
    WindowMinimizeAll1: TWindowMinimizeAll;
    WindowTileHorizontal1: TWindowTileHorizontal;
    WindowTileVertical1: TWindowTileVertical;
    Close1: TMenuItem;
    MinimizeAll1: TMenuItem;
    N2: TMenuItem;
    procedure New1Click(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
    procedure New2Click(Sender: TObject);
    procedure CloseAll1Click(Sender: TObject);
    procedure Count1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    Count: Integer;
    OutCanvas: TCanvas;
    OldWinProc, NewWinProc: Pointer;
    procedure NewWinProcedure (var Msg: TMessage);
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.New1Click(Sender: TObject);
var
  ChildForm: TCircleChildForm;
begin
  Inc (Count);
  ChildForm := TCircleChildForm.Create (Self);
  ChildForm.Caption := ChildForm.Caption + ' ' +
    IntToStr (Count);
  ChildForm.Show;
end;

procedure TMainForm.Exit1Click(Sender: TObject);
begin
  Close;
end;

procedure TMainForm.New2Click(Sender: TObject);
var
  ChildForm: TBounceChildForm;
begin
  Inc (Count);
  ChildForm := TBounceChildForm.Create (Self);
  ChildForm.Caption := ChildForm.Caption + ' ' +
    IntToStr (Count);
  ChildForm.Show;
end;

procedure TMainForm.CloseAll1Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to MDIChildCount - 1 do
    MDIChildren [I].Close;
end;

procedure TMainForm.Count1Click(Sender: TObject);
var
  NBounce, NCircle, I: Integer;
begin
  NBounce := 0;
  NCircle := 0;
  for I := 0 to MDIChildCount - 1 do
    if MDIChildren [I] is TBounceChildForm then
      Inc (NBounce)
    else
      Inc (NCircle);
  MessageDlg (
    Format ('There are %d child forms.'#13 +
      '%d are Circle child windows and ' +
      '%d are Bouncing child windows',
      [MDIChildCount, NCircle, NBounce]),
    mtINformation, [mbOk], 0);
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
  NewWinProc := MakeObjectInstance (NewWinProcedure);
  OldWinProc := Pointer (SetWindowLong (
    ClientHandle, gwl_WndProc, Cardinal (NewWinProc)));
  OutCanvas := TCanvas.Create;
end;

procedure TMainForm.NewWinProcedure (var Msg: TMessage);
var
  BmpWidth, BmpHeight: Integer;
  I, J: Integer;
begin
  // default processing first
  Msg.Result := CallWindowProc (OldWinProc,
    ClientHandle, Msg.Msg, Msg.wParam, Msg.lParam);

  // handle background repaint
  if Msg.Msg = wm_EraseBkgnd then
  begin
    BmpWidth := MainForm.Image1.Width;
    BmpHeight := MainForm.Image1.Height;
    if (BmpWidth <> 0) and (BmpHeight <> 0) then
    begin
      OutCanvas.Handle := Msg.wParam;
      for I := 0 to MainForm.ClientWidth div BmpWidth do
        for J := 0 to MainForm.ClientHeight div BmpHeight do
          OutCanvas.Draw (I * BmpWidth,
            J * BmpHeight, MainForm.Image1.Picture.Graphic);
    end;
  end;
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  OutCanvas.Free;
end;

end.
Child.pas
unit Child;

interface

uses Windows, Classes, Graphics, Forms, Controls, Menus,
  Dialogs, SysUtils;

type
  TCircleChildForm = class(TForm)
    MainMenu1: TMainMenu;
    Circle1: TMenuItem;
    FillColor1: TMenuItem;
    BorderColor1: TMenuItem;
    BorderSize1: TMenuItem;
    N1: TMenuItem;
    GetPosition1: TMenuItem;
    ColorDialog1: TColorDialog;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FillColor1Click(Sender: TObject);
    procedure BorderColor1Click(Sender: TObject);
    procedure BorderSize1Click(Sender: TObject);
    procedure GetPosition1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    XCenter, YCenter: Integer;
    BorderSize: Integer;
    BorderColor, FillColor: TColor;
  public
    { Public declarations }
  end;

implementation

{$R *.DFM}

procedure TCircleChildForm.FormCreate(Sender: TObject);
begin
  XCenter := - 200;
  YCenter := - 200;
  BorderSize := 1;
  BorderColor := clBlack;
  FillColor := clYellow;
end;

procedure TCircleChildForm.FormPaint(Sender: TObject);
begin
  Canvas.Pen.Width := BorderSize;
  Canvas.Pen.Color := BorderColor;
  Canvas.Brush.Color := FillColor;
  Canvas.Ellipse (XCenter-30, YCenter-30, XCenter+30, YCenter+30);
end;

procedure TCircleChildForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  XCenter := X;
  YCenter := Y;
  Refresh;
end;

procedure TCircleChildForm.FillColor1Click(Sender: TObject);
begin
  ColorDialog1.Color := FillColor;
  if ColorDialog1.Execute then
    begin
      FillColor := ColorDialog1.Color;
      Repaint;
    end;
end;

procedure TCircleChildForm.BorderColor1Click(Sender: TObject);
begin
  ColorDialog1.Color := BorderColor;
  if ColorDialog1.Execute then
    begin
      BorderColor := ColorDialog1.Color;
      Repaint;
    end;
end;

procedure TCircleChildForm.BorderSize1Click(Sender: TObject);
var
  InputString: string;
begin
  InputString := IntToStr (BorderSize);
  if InputQuery ('Border', 'Insert width', InputString) then
    begin
      BorderSize := StrToIntDef (InputString, BorderSize);
      Repaint;
    end;
end;

procedure TCircleChildForm.GetPosition1Click(Sender: TObject);
begin
  MessageDlg ('The center of the circle is in the position (' +
    IntToStr (XCenter) + ', ' + IntToStr (YCenter) + ').',
    mtInformation, [mbOk], 0);
end;

procedure TCircleChildForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action := caFree;
end;

end.
Child2.pas
unit Child2;

interface

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

type
  Directions = (up_right, down_right, down_left, up_left);

  TBounceChildForm = class(TForm)
    Timer1: TTimer;
    Shape1: TShape;
    MainMenu1: TMainMenu;
    Square1: TMenuItem;
    FillColor1: TMenuItem;
    N1: TMenuItem;
    GetPosition1: TMenuItem;
    Movement1: TMenuItem;
    Start1: TMenuItem;
    Stop1: TMenuItem;
    ColorDialog1: TColorDialog;
    procedure Timer1Timer(Sender: TObject);
    procedure FillColor1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure GetPosition1Click(Sender: TObject);
    procedure Start1Click(Sender: TObject);
    procedure Stop1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    Dir : Directions;
  public
    { Public declarations }
  end;

implementation

{$R *.DFM}

procedure TBounceChildForm.Timer1Timer(Sender: TObject);
begin
  case Dir of
    up_right:
    begin
      Shape1.Left := Shape1.Left + 3;
      Shape1.Top := Shape1.Top - 3;
      if Shape1.Top <= 0 then
        Dir := down_right;
      if Shape1.Left + Shape1.Width >= ClientWidth then
        Dir := up_left;
    end;
    down_right:
    begin
      Shape1.Left := Shape1.Left + 3;
      Shape1.Top := Shape1.Top + 3;
      if Shape1.Top + Shape1.Height >= ClientHeight then
        Dir := up_right;
      if Shape1.Left + Shape1.Width >= ClientWidth then
        Dir := down_left;
    end;
    down_left:
    begin
      Shape1.Left := Shape1.Left - 3;
      Shape1.Top := Shape1.Top + 3;
      if Shape1.Top + Shape1.Height >= ClientHeight then
        Dir := up_left;
      if Shape1.Left <= 0 then
        Dir := down_right;
    end;
    up_left:
    begin
      Shape1.Left := Shape1.Left - 3;
      Shape1.Top := Shape1.Top - 3;
      if Shape1.Top <= 0 then
        Dir := down_left;
      if Shape1.Left <= 0 then
        Dir := up_right;
    end;
  end;
end;

procedure TBounceChildForm.FillColor1Click(Sender: TObject);
begin
  if ColorDialog1.Execute then
    Shape1.Brush.Color := ColorDialog1.Color;
end;

procedure TBounceChildForm.FormCreate(Sender: TObject);
begin
  ColorDialog1.Color := Shape1.Brush.Color;
  Dir := down_left;
end;

procedure TBounceChildForm.GetPosition1Click(Sender: TObject);
begin
  MessageDlg ('The top-left corner of the square was in the position (' +
    IntToStr (Shape1.Left) + ', ' + IntToStr (Shape1.Top) + ').',
    mtInformation, [mbOk], 0);
end;

procedure TBounceChildForm.Start1Click(Sender: TObject);
begin
  Timer1.Enabled := True;
  Start1.Enabled := False;
  Stop1.Enabled := True;
end;

procedure TBounceChildForm.Stop1Click(Sender: TObject);
begin
  Timer1.Enabled := False;
  Start1.Enabled := True;
  Stop1.Enabled := False;
end;

procedure TBounceChildForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action := caFree;
end;

end.
Frame.dfm
object MainForm: TMainForm
  Left = 224
  Top = 188
  Width = 435
  Height = 299
  Caption = 'MDI Frame'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -13
  Font.Name = 'System'
  Font.Style = []
  FormStyle = fsMDIForm
  Menu = MainMenu1
  OldCreateOrder = True
  WindowMenu = Window1
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  PixelsPerInch = 96
  TextHeight = 16
  object Image1: TImage
    Left = 16
    Top = 56
    Width = 153
    Height = 139
    AutoSize = True
    Picture.Data = {
      07544269746D6170E62B0000424DE62B00000000000076000000280000009900
      00008B0000000100040000000000702B00000000000000000000100000000000
      000000000000000080000080000000808000800000008000800080800000C0C0
      C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF
      FF00777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      77777777777777777777777777777F0000007777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777F26
      2626777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      77777777777777777777777777777F6262627777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777F00
      0000777777777777777777877887787878777777774041404044040488888877
      7777777777777777777777777777777777777777777777777777777777777777
      77777777777777777777777777777FFFFFFF7777777777777778878888788878
      878878778777404FF8F8F8405777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777F00
      0000777777777777887878777777777877878F88F877040FF8F8888408888777
      777777777777777777777777777777777777F777777777777777777777777777
      77777777777777777777777777777F0000007777777777878787777777777777
      777778778788450FFFFFFFFF487777777777777777777777777B77B7777B797B
      7B7B7777777F7777777777777777777777777777777777777777777777777FFF
      FFFF7777777778F87777777777777777777777777777804F8F8FF8F8F0777777
      777777F77B7777B779789798389883889797B7B7777B77B77777777777777777
      77777777777777777777777777777FFFF000777777778F877777777777777777
      77777777777774088F88FFFFF477777777777777778988983898383893839839
      8373797B7B777777BF7777777777777777777777777777777777777777777FFF
      FFFF77777778787777777777777777777777777777777040FF8F888F87777777
      7777779838183188183818813818389838937B7397B7B7B77777777777777777
      77777777777777777777777777777FFFFFFF7777778877777777777777777777
      7777777777777540FFFFFF8F87877777777B8988183818313181313181312131
      3183939B7B897B77B7B7F7777777777777777777777777777777777777777FFF
      FFFF7777788777777777777777BBBBBBBBBBBBBBB8877704F8F8F8F8F8F87777
      779888318181301803121812131813838393373739B7B97B7777B77777777777
      77777777777777777777777777777FFFFFFF77777877777777777779BBB87777
      777777778BBBBB408FFFFFFFF8F8887773883108121181813181131812131303
      13389339B37B8BB7B7B777B77777777777777777777777777777777777777FFF
      FFFF77777877777777777BBB77777777777777777777774058BFFF8FFFFF8877
      89818181181212110121812181318131381339373739B979B7B7B77777777777
      77777777777777777777777777777FFFFFFF777787777777777BBB7777777777
      77777777777777840F8888F8F8F8F87988812180301181121811213131813183
      13393839B9B7B7B7B77777777777777777777777777777777777777777777FFF
      FFFF7778F877777777BB77777777777777777777777777704F8F88888FF888B8
      881811018130108131031112130312138138339338379B8B97BB7B7777777777
      77777777777777777777777777777FFFFFFF7777877777777B97777777777777
      777777777777777404FF8F888888889891818030101803101031803181318313
      13393938B9BB37BB7B7777777777777777777777777777777777777777777F00
      0F02777877777777BB77777777777777777777777777777050F8888888888878
      883881818121112118103181303131813813383937397B97B77B7B7777777777
      77777777777777777777777777777F00000F77788777777BB777777777777777
      777777777777777404F88F8888F8897B31011081801180130121112113181318
      313893939B8B9B8B97B777777777777777777777777777777777777777777F44
      444477787777778B777777777777777777777777777777784188F888D8888889
      7B71081138121810311812112131313313393337339B8B7B7B7B777777777777
      7777777777777777777777777777774444447778777777B77777777777777777
      777777777777777740488888888888888177B108018812118121181318121381
      318338939B8B8B9B7B77777777777777777777777777777777777777777777FF
      FF007778777777B777777777777777777777777777777777041F878888898831
      0810B8B1181181821181211213181213833939338B9B9B7379FB777777777777
      777777777777777777777777777777000000777877777B877777777777777777
      77777777777777784404777778838103010301B8B01218181212118112131313
      1318338B93737B9B7B77777777777777777777777777777777777777777777FF
      FFFF777877777B77777777777777777777777777777777888888888788898181
      80101010B37110318181130318131831833393937B9B97B7B7BF777777777777
      77777777777777777777777777777FFFFFFF777877777B777777777777777777
      7777777777777777777777777778930101080131183371181381213103103913
      13938B8339B8B89B7B77777777777777777777777777777777777777777777FF
      FFFF777878777B77777777777777777777777777777777777777777777777811
      2110180121183B8108181801318130383389339B8B8B8BB89777777777777777
      777777777777777777777777777777FFFFFF777877777B777777777777777777
      77777777777777777777777777777777112110181121283B1108181810313131
      31339379B3B9B97BB7B7777777777777777777777777777777777777777777FF
      FFFF777787778B77777777777777777777777777777777777777777777777777
      7771030112111181B81309803112181383938B3B9737B8B97B77777777777777
      777777777777777777777777777777FFFFFF777787778B777777777777777777
      7777777777777777777777777777777777777112181303012B89121812181318
      13839B9739B73B97B777777777777777777777777777777777777777777777FF
      FFFF77778777BB77777777777777777777777777777777777777777777777777
      7777777130108118103B8118181301313313373B7B9B373B77B7777777777777
      777777777777777777777777777777FFFFFF777787778B777777777777777777
      7777777777777777777777777777777777777777113112121080B73108181303
      183939B9B8B97B7B9B7777777777777777777777777777777777777777777706
      260F777778777B77777777777777777777777777777777777777777777777777
      77777777730301111311017391218131313838379B8B9B97B777777777777777
      777777777777777777777777777777000000777778787B777777777777777777
      7777777777777777777777777777777777777777711181218010303838180812
      18339373B79B8B8B97BF777777777777777777777777777777777777777777FF
      000F777778777B77777777777777777777777777777777777777777777777777
      77777777712121101318110818B138181318339B8B37B9B8B77B777777777777
      777777777777777777777777777777000000777777877B777777777777777777
      7777777777777777777777777777777777777777718110318013013103889188
      31313839B97B8B7B7B7777777777777777777777777777777777777777777700
      0000777777877B77777777777777777777777777777777777777777777777777
      77777777701218121130130131338B118181313373B9B79B97B7777777777777
      77777777777777777777777777777F77FFFF7777777878B77777777777777777
      77777777777777777777777777777777777777777313108103013183183898B7
      38398318397373B7B7B7777777777777777777777777777777777777777777FF
      FFFF7777777877B7777777777777777777777777777777777777777777777777
      7777777771010311811383939393338379883933139B9B79B777777777777777
      777777777777777777777777777777FFFFFF7777777877B77777777777777777
      7777777777777777777777777777777777777777718131031381331338318393
      8B93889383337B37B7B7F77777777777777777777777777777777777777777FF
      FFFF7777777787B8777777777777777777777777777777777777777777777777
      77777777731810812133138313133138378983839389397B9B7B777777777777
      777777777777777777777777777777FFFFFF77777777878B7777777777777777
      7777777777777777777777777777777777777777773013131318131213381313
      138B89883933373B7977777777777777777777777777777777777777777777FF
      FFFF7777777778FB777777777777777777777777777777777777777777777777
      777777777711213181213013181138393938B898383939B83B7B777777777777
      777777777777777777777777777777FFFFFF77777777778BB777777777777777
      7777777777777777777777777777777777777777770318131311818112131383
      383938B98983833587B7404404087777777777777777777777777777777777FF
      FFFF77777777778FB77777777777777777777777777777777777777777777777
      777777777711318030121030313839B9B93B8373738939B8B04014007F740777
      777777777777777777777777777777FFFFFF77777777778FB877777777777777
      777777777777777777777777777777777777777777380311818113118139B7B7
      B7B9393789B838937B4877FF7F7FF4778777777777777777777777777777770F
      FFFF777777777778FB7777777777777777777777777777777777777777777777
      7777777777713103010301831BB77B77B97B8B93378973B939B477FFFFF8F878
      787777777777777777777777777777F000007777777777778B87777777777777
      77777777777777777777777777777777777777777713108131313939B777B77B
      77B9B3739B8B8983334085047F7FF8787778777777777777777777777777770F
      FF007777777777778FB777777777777777777777777777777777777777777777
      77777777773013110813833B7B7B77B77B3739393837379734897BFF04F88878
      8787778777777777777777777777770FFFF077777777777778B8777777777777
      7777777777777777777777777777777777777777781810121103137777777B77
      B97B8B83339873794838B77FF04F8F8F87778777777777777777777777777700
      0FFF777777777777778B77777777777777777777777777777777777777777777
      77777777713108112111813338B7B7B7B7B9393989333738409B8B7FFF41F888
      F8777777777777777777777777777700FFFF777777777777778B877777777777
      777777777777777777777777777777777777777731031030103010118393B9B7
      B93833833339897405389B77FF040F88888887878777777777777777777777FF
      FFFF7777777777777778B7777778777777778777777777777777777777777777
      7777777731301118180130121038379B73933131389333B04073B77FFFF408F8
      F87777777777777777777777777777BFFF7F7777777777777778B87787777878
      7777777777777777777777777777777777777777108180301318031813139B7B
      9338181313839734807979B7FFF0408888787877777777777777777777777F7F
      BFBF77777777777777778B777778777778777777777777777777777777777777
      77777778131010113011311313183B7B8313131383933394048B8B77FFF80488
      888887887877777777777777777777FFFFFF7777777777777777788778787887
      8778778777777777777777777777777777777771310301081303183937BB9733
      1181308313389B3B41787977FFFF4148F87787777777777777777777777777FF
      FFFF777777777777777787BB8F8F88F887877777777777777777777777777777
      777777830181130101813338B7F7FB81031211311393379B404B877B7FFF040F
      8F8777777777777777777777777777FFFFFF7777777777777777778888F88F88
      87887877777777777777777777777777777777311301801301210101337B3810
      31811303838393738417B877BFFF4048787787777777777777777777777777FF
      FFFF777777777777777778FBB888888F888F8F87777777777777777777777777
      7777771210121130110108101010010310121813139373B9B408797877FF8057
      777777777777777777777777777777FFFFFF77777777777777778F8F8B88F888
      8F88F87778777777777777777777777777777813181112181081310801013931
      8131310318339B8B7340B7B877FF8447777777777777777777777777777777FF
      FFFF777777777777778778888B88888F88F88778777777777777777777777777
      7777713010308131831131311331B83130812131339379B79B840977877F4007
      777777777777777777777777777777000F0277777777777777778F888F8888F8
      8F88F887777777777777777777777777777783113101101211338393397FB793
      1311813839373B8B7B7848B9787F047777777777777777777777777777777700
      0000777777777777778788F888BB8F8F8FBF8F87878777777777777777777777
      7777310810121811030313877FF7FB8318303131839397B9B9B9B407B8805777
      777777777777777777777777777777FFFFFF7777777777777778F8888888B888
      8888F878777777777777777777777777777710310810101218181337BF7FB9B9
      3131318338B8B9B7B7B7B97040847777777777777777777777777777777777FF
      FFFF777777777777778F8F88F8F8B8F8F8F88B77787777777777777777777777
      7778131210101211013108137B777B83931831393939B8B79B79B7B7B98887B7
      777777777777777777777777777777FFFF0F7777777777777778F888888F8B88
      BFBFF888B77777777777777777777777777318011018010813013133138B7B93
      8313131337B37B97B7B7B7B9B838878777777777777777777777777777777FFF
      FFFF777777777777778F88F88F88BF8FF888B78F87B777777777777777777777
      7771011803010101011211018137B383131838389397B7B7B9B79B77B9318889
      7777777777777777777777777777777FFF7F7777777777777778F888F8FF8FBF
      BFF8778B77877777777777777777777777731210101018033838138012317393
      31313139B8BB89B7B77B7B7B9733188817777777777777777777777777777777
      777777777777777777778F8F8888BF888FB77B777B7B77777777777777777777
      7771018101801091011131131113B938183138338B97BB79B7B7B77B7B110188
      818777777777777777777777777777F7F77F77777777777777878F88F8F8F8F8
      78778778B7777777777777777777777777818101010101213183B7B313777331
      33183939B37B97BB7B77B7B7B8B33B38898377B77777777777777777777777FF
      FFFF7777777777777777788F88BFBFF8777877B7778B77777777777777777777
      7731031080121810139B7FFFFFFFF3138131338B379B7B797B7B777B7B10313B
      889898979777777777777777777777FFFFFF7777777777777777877878F88FB7
      787778787B778777777777777777777777801121010101033837FFFFFFFF7931
      3933893973B8B7B7B777BFB77B398103381338B83777777777777777777777FF
      FFFF77777777777777777878788BFF8777787777787B77777777777777777777
      771308101081031813B7FFFFFFFF383938393B8B9B7B97B77B7B7B77BB130181
      3B8101017B77777777777777777777FFFFFF7777777777777777777878F8FB77
      B777787B7B77877777777777777777773130110130101101339FFFFFFFFB9383
      39B389B8B97B7B7B7777F7FB7B31331383B89337BFF7B77BBBBBBB77777777FF
      FFFF777777777777777777877BFBF88787777778777B77777777777777777777
      1810121001018031838FFFFFFFB7B9B9B8393B9B8B9B77B7B7BFB7BF7B313177
      B87B397BFBFBFBB7777777B777777706260F777777777777777777778F8F8F87
      777B778F88B787777777777777777773121181018101010139B7FFFFFF7B77B7
      B9B8B8B8B7B77B7F7FF7F7F7BB9837313988BB777FFF777777777777777777FF
      FFFF7777777777777777777778FB7B77B787777B787777777777777777777771
      3112101010801081383FFFF7F7BF7B79B79B9B9B97B7BF77BF7BF7BFBB339181
      3038837B7F7FB7777777777B777777FFFFFF7777777777777777777777877788
      77778B77787B777777777777777777180181010801010112133FFFFFF77FB77B
      8B8B8B8B7BB777BF7F7FF7777793033183183BBBF777B777777777B777777FFF
      FFF477777777777777777777777B7BF87B7B777B7B7877777777777777777301
      13018101210180011397FFFBFF7B77B7B9B79B98B777BFF7FBF7BFF7B3B11313
      131BB83B7B7B7777777777B77777770FFFFF77777777777777777777777878F8
      888778BF8877777777777777777781312130101101210181383FF7F7FBF77B7B
      9833337B97BF7F7FF7F7F7BBBBBBB83931B318831838377777777B7777777777
      FF4477777777777777777777777778B778F8BFF8878777777777777777773181
      8103108010101010393BFFFF777B7B9333138133B7F7FFFFF7FBBBF779B31B8B
      BB38181833181B7777777B77777777FFFFFF7777777777777777777777777787
      BFBF8FB777777777777777777777112131810101801108010397F7F7B7B7B833
      8121131837BFFFFFFFB7F7FB7B39303B0133B3B8B91387777777B777777777FF
      FFFF777777777777777777777777777778787877777777777777777777730311
      0318031018121101318B7FBF7B79339013138131B77FFFFFFFBFFF7FB9339B13
      318139837B339337777B7777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777771812131011103010101210339F7F7B8331309
      318103739B77F7B77FB7FBF7B83BBB793131838788BBB38977B77777777777FF
      FFFF777777777777777777777777777777777777777777777777777777713118
      01303081301801018138B77B7B9318120131313377B7B8B8B7B7FF77B9BBB77B
      8B931389B83713BB7B777777777777FFFFFF7777777777777777777777777777
      777777777777777777777777777701213181011011301801031377B793813101
      13121318338313138B9B77B7BB7BFBFB71238108888B131BBB777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777771811
      030131218010101103138B77331210812181813311303139337BB77BB9BF7FF7
      B9113318108B13BB77BB7777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777777731081310810180108100183397B31318110
      13103181281138933937FBBB38BF7FFBF7B3938398883B377777B777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777771
      3103131301010108113183B398121031810110111138133839B777BB39BF7F7F
      B79739373897B97777777BB77777770FFFFF7777777777777777777777777777
      7777777777777777777777777777777103181010318030101803389731311121
      383383308313B79B837F7BB9B38B77FB83338BB97BBB8B777777777B777777F4
      44FF777777777777777777777777777777777777777777777777777777777813
      1031318101010112109139333112180110101011397B73393B7FBB731BB17BB3
      180138777B878B7777777777B77777444F447777777777777777777777777777
      7777777777777777777777777778138018130310181301211303831813813131
      213130338B33931B7FFB7B93831BB31B3131313B7FFF88B7777777777B7777FF
      F444777777777777777777777777777777777777777777777777777777712111
      21081103011081180131383331121318130181313181337FF7B7B731B31837B3
      B1331B33837378B77777777777B777FFF4447777777777777777777777777777
      7777777777777777777777777771810311313031030313011813131318318131
      313130981393FFFFFFB79383117B7B79BB1BB131188138B777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777121318
      12110181318110312131839393131383138939337BFFFFFFFFB7B313837BFFB7
      9BB3B337B89B77BFB777777777777FFFF8317777777777777777777777777777
      7777777777777777777777777711210018031310103018101303183839383939
      379B7B7FBFF7FFF7F7B7391317BFFBFBB33339BBB7739BFBFB77777777B777FF
      FFFF777777777777777777777777777777777777777777777777777773181131
      31180103181310318131331393B9B977B7B77777F7FFFFFFFFB383389BF7FF7F
      B7BFFFB79BBBB77F7FB77777BB7777FFFFFF7777777777777777777777777777
      7777777777777777777777777830180103031810310121031318313383737B7B
      777B7BFBF7F7FFFF77BBB9133B77FFFB713B9FF7B77BFBFFFF7BBBB7777777BF
      FFFF777777777777777777777777777777777777777777777777777777113013
      18113031101811812133183939B7B7B7BB77F77FBFFF7F7F77B9B8B33BBFF7B7
      9313B37F77FF77FFF7B77777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777312101031030118013031018121339383B9B7B7
      777B7BFBFFBFFFF7BB83397FFF7B7BF339B7B7BFF777BB7BFB777777777777FF
      FFFF777777777777777777777777777777777777777777777777777771811818
      109810303101121313181383397B97B7B7BF77F7F7FF777B779138391819339B
      7F77BBFFF7F77F77B7777777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777030301121211811081081310313313937B37B97
      B777BF7BF7F7BF7B9B7BB9BBBB3B77FFF7B7B9BFF7FFFFF8B7777777777777FF
      FFFF777777777777777777777777777777777777777777777777777771110312
      1110301031031018138138339B97B77B77B777BF7FB7F7B7BF7FFF7777FFF7BF
      39BB839B7FFFFFF8B7777777777777FFFFFF7777777777777777777777777777
      77777777777777777777777778121181180311811031031213131398B37B77B7
      7B77B7777BF7B9B77393137B7F7777B13897FFFBB7FFFF78B7777777777777FF
      F002777777777777777777777777777777777777777777777777777777109213
      01010310811031813183983398B97B77B77B777B777B8373983138138B3B3103
      13FFF7FF7BF77BF8B7777777777777FFFFFF7777777777777777777777777777
      777777777777777777777777778121103131803103081121831333397BB7B77B
      797B7B777B739B9313833939310101813B8B37777F3BB778B7777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777710103
      101211031111218131813893B97B7B77B7B777B7B79338333393933833181313
      7F139338FFBBBBBB7777777777777FFFFFFF7777777777777777777777777777
      7777777777777777777777777777181081810130801211311338933737B77B7B
      7B7B7B7B8138139FFFF7B7B9B939337BF38B39739FFFF7F877777777777777FF
      FF0F777777777777777777777777777777777777777777777777777777771031
      101080101181130383933893797B7B7B97B73381333137F739B7FF77B77B77FF
      F1397777F7FFFF78777777777777778121317777777777777777777777777777
      777777777777777777777777777773103013113103030813183939B3B8B7977B
      73118313381BF7B7FF7FBFFFFFFFFFFF33FF77FFFFFFFF8C77777777777777FF
      FFF7777777777777777777777777777777777777777777777777777777777101
      0181218011011313393837379B7B7B97383839B913FFBFFFFFFFF7FFFFFFFF39
      7FF7FFFFFFF7FF8777777777777777FFFFFF7777777777777777777777777777
      777777777777777777777777777778121310110180112181383B939B8B9B87B8
      18131837FF7FF79339BFFFF7B7B9377FF77F7FBFFFFFFF8777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777718
      1001803101801313133938B8B7B7B333133877F7F7F89337FFF7BFFFFFF7FF7F
      77FFFFF77FFFFC8777777777777777FF7FFF7777777777777777777777777777
      77777777777777777777777777777711013101012110103839373B9B39739018
      11813377F98388F89377F7FF7F7F77F77FFFFFFFFFFFF87777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777772
      1801031810308101383B938383318931339B7F7B83897F383773777FF7FF7B87
      FFFFFFFF7FFF877777777777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777777777110181010981010121398393131003081
      81337393313FF17F7F7F7B77973337FFFFFFFFFFFFFC877777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777777
      1211031303131811383B831301811138388931313FF73FFFFFFFFFF7BB97FFFF
      FFFFFFFFFF88777777777777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777777777781103181310133893939318010133339
      39B7787F404041B9B87FFFFFF7FFFFF77777FFFFFC8777777777777777777706
      260F777777777777777777777777777777777777777777777777777777777777
      7308121393810138BB7B930113397FF7FB77F040873F7048FFF7FFF7FFFFFF77
      FFFF7FFF887777777777777777777FFFFFFF7777777777777777777777777777
      777777777777777777777777777777777131113383939893977B713137738139
      3777F04797777F408FFFFFFF777FF77FFF7FFC88777777777777777777777700
      0000777777777777777777777777777777777777777777777777777777777777
      7703083131033BB37B777393713B9B7B7B7B714877F77880587FFFFFFFFFFFFF
      FFC888777777777777777777777777FFFFF07777777777777777777777777777
      777777777777777777777777777777777711131830100187FBFB7B831B77FF7F
      777777577779FFF4078888888C88C8888887777777777777777777777777770B
      99BB777777777777777777777777777777777777777777777777777777777777
      777121393981313937FF7B139FFB739BFBF7FF7F777FF7F04FF777F7777877FF
      F7777777777777777777777777777B77CCCC7777777777777777777777777777
      7777777777777777777777777777777777781303839B8BB77F777F37B3181389
      377FF7F777F77750477FFFFFFFFF77FFFB777777777777777777777777777754
      0FFF777777777777777777777777777777777777777777777777777777777777
      777718133130137B77BFFF71113B9BB7B7777777777FF8404FFFF77777777FFF
      777777777777777777777777777777FFFFFF7777777777777777777777777777
      7777777777777777777777777777777777777131379311133B7B7B3137B77FF7
      FFFF7FF77F7F84048F777FFFFF7F7777777777777777777777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777777
      77777731833777B7FFF7FFFB7FF7339B7FFFFF7F7F774140FF7FFF7777FF7777
      777777777777777777777777777777FFFF7F7777777777777777777777777777
      777777777777777777777777777777777777777131383B7777FFFFFF733B7FFF
      FFFF7FF7F774040777FFF7FFFF777777777777777777777777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777777
      77777777393938B7B7B7777BFFFFFFFFFFFFFF7F7850487777FFF7FF77777777
      777777777777777777777777777777FFFFFF7777777777777777777777777777
      777777777777777777777777777777777777777773833937B7777F7FF77F7FFF
      7F7F7F7774408F7F7F7F7F7777777777777777777777777777777777777777FF
      FFFF777777777777777777777777777777777777777777777777777777777777
      7777777777B93739B7B7BF7FBFFFFFFFF7F777778400FFFF77F7F77777777777
      77777777777777777777777777777FFFFFFF7777777777777777777777777777
      77777777777777777777777777777777777777777777B93B97B777BF777FBFB7
      77777777414F777777777777B77777777777777777777777777777777777770F
      FFFF777777777777777777777777777777777777777777777777777777777777
      77777777777777B7B7B7B7F7777777F777F77777404777777787777777777777
      777777777777777777777777777777CCAAAA7777777777777777777777777777
      777777777777777777777777777777777777777777777777B7B7777777777777
      77777777740777777707777777777777777777777777777777777777777777DD
      DCCC777777777777777777777777777777777777777777777777777777777777
      77777777777777777777B777777777B7F7F77777740777777047777777777777
      77777777777777777777777777777FB139FF7777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      777777F7F7047777044777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777404047787777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777707
      0000777777777777777777777777777777777777777777777777777777777777
      7777777777777777777777777777777777777777777777777777777777777777
      777777777777777777777777777777FF7777}
  end
  object MainMenu1: TMainMenu
    Left = 16
    Top = 8
    object File1: TMenuItem
      Caption = '&File'
      GroupIndex = 1
      object New1: TMenuItem
        Caption = '&New Circle'
        OnClick = New1Click
      end
      object New2: TMenuItem
        Caption = 'New &Bouncing Square'
        OnClick = New2Click
      end
      object Close1: TMenuItem
        Action = WindowClose1
      end
      object CloseAll1: TMenuItem
        Caption = 'Clo&se All'
        OnClick = CloseAll1Click
      end
      object N1: TMenuItem
        Caption = '-'
      end
      object Exit1: TMenuItem
        Caption = '&Exit'
        OnClick = Exit1Click
      end
    end
    object Window1: TMenuItem
      Caption = '&Window'
      GroupIndex = 3
      object Cascade1: TMenuItem
        Action = WindowCascade1
      end
      object Tile1: TMenuItem
        Action = WindowTileHorizontal1
      end
      object Tile2: TMenuItem
        Action = WindowTileVertical1
      end
      object ArrangeIcons1: TMenuItem
        Action = WindowArrange1
      end
      object MinimizeAll1: TMenuItem
        Action = WindowMinimizeAll1
      end
      object N2: TMenuItem
        Caption = '-'
      end
      object Count1: TMenuItem
        Caption = 'Count'
        OnClick = Count1Click
      end
    end
  end
  object ActionList1: TActionList
    Left = 24
    Top = 72
    object WindowArrange1: TWindowArrange
      Category = 'Window'
      Caption = 'Arrange Icons'
    end
    object WindowCascade1: TWindowCascade
      Category = 'Window'
      Caption = 'Cascade'
      ImageIndex = 17
    end
    object WindowClose1: TWindowClose
      Category = 'Window'
      Caption = 'Close'
    end
    object WindowMinimizeAll1: TWindowMinimizeAll
      Category = 'Window'
      Caption = 'Minimize All'
    end
    object WindowTileHorizontal1: TWindowTileHorizontal
      Category = 'Window'
      Caption = 'Tile Horizontal'
      ImageIndex = 15
    end
    object WindowTileVertical1: TWindowTileVertical
      Category = 'Window'
      Caption = 'Tile Vertical'
      ImageIndex = 16
    end
  end
end
Child.dfm
object CircleChildForm: TCircleChildForm
  Left = 223
  Top = 148
  Width = 361
  Height = 213
  Caption = 'MDI Child'
  Color = clTeal
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  FormStyle = fsMDIChild
  Menu = MainMenu1
  OldCreateOrder = True
  Position = poDefault
  Visible = True
  OnClose = FormClose
  OnCreate = FormCreate
  OnMouseDown = FormMouseDown
  OnPaint = FormPaint
  PixelsPerInch = 96
  TextHeight = 13
  object MainMenu1: TMainMenu
    Left = 8
    Top = 8
    object Circle1: TMenuItem
      Caption = '&Circle'
      GroupIndex = 2
      object FillColor1: TMenuItem
        Caption = '&Fill Color...'
        OnClick = FillColor1Click
      end
      object BorderColor1: TMenuItem
        Caption = '&Border Color...'
        OnClick = BorderColor1Click
      end
      object BorderSize1: TMenuItem
        Caption = 'Border &Size...'
        OnClick = BorderSize1Click
      end
      object N1: TMenuItem
        Caption = '-'
      end
      object GetPosition1: TMenuItem
        Caption = '&Get Position'
        OnClick = GetPosition1Click
      end
    end
  end
  object ColorDialog1: TColorDialog
    Ctl3D = True
    Left = 40
    Top = 8
  end
end
Child2.dfm
object BounceChildForm: TBounceChildForm
  Left = 418
  Top = 289
  AutoScroll = False
  Caption = 'Bouncing Square'
  ClientHeight = 126
  ClientWidth = 243
  Color = clAqua
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -13
  Font.Name = 'System'
  Font.Style = []
  FormStyle = fsMDIChild
  Menu = MainMenu1
  OldCreateOrder = True
  Position = poDefault
  Visible = True
  OnClose = FormClose
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 16
  object Shape1: TShape
    Left = 40
    Top = 48
    Width = 30
    Height = 30
    Brush.Color = clFuchsia
    Pen.Color = clBlue
    Pen.Width = 2
    Shape = stSquare
  end
  object Timer1: TTimer
    Interval = 200
    OnTimer = Timer1Timer
    Left = 8
    Top = 8
  end
  object MainMenu1: TMainMenu
    Left = 40
    Top = 8
    object Square1: TMenuItem
      Caption = '&Square'
      GroupIndex = 2
      object FillColor1: TMenuItem
        Caption = '&Fill Color...'
        OnClick = FillColor1Click
      end
      object N1: TMenuItem
        Caption = '-'
      end
      object GetPosition1: TMenuItem
        Caption = '&Get Position'
        OnClick = GetPosition1Click
      end
    end
    object Movement1: TMenuItem
      Caption = '&Movement'
      GroupIndex = 2
      object Start1: TMenuItem
        Caption = '&Start'
        Enabled = False
        OnClick = Start1Click
      end
      object Stop1: TMenuItem
        Caption = 'S&top'
        OnClick = Stop1Click
      end
    end
  end
  object ColorDialog1: TColorDialog
    Ctl3D = True
    Left = 72
    Top = 8
  end
end