MAIN.PAS
上传用户:lmk588
上传日期:2013-04-16
资源大小:5120k
文件大小:3k
源码类别:

按钮控件

开发平台:

Delphi

  1. unit MAIN;
  2. interface
  3. uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus,
  4.   StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls, StdActns,
  5.   ActnList, ToolWin, ImgList, WinSkinData;
  6. type
  7.   TMainForm = class(TForm)
  8.     MainMenu1: TMainMenu;
  9.     File1: TMenuItem;
  10.     FileNewItem: TMenuItem;
  11.     FileOpenItem: TMenuItem;
  12.     FileCloseItem: TMenuItem;
  13.     Window1: TMenuItem;
  14.     Help1: TMenuItem;
  15.     N1: TMenuItem;
  16.     FileExitItem: TMenuItem;
  17.     WindowCascadeItem: TMenuItem;
  18.     WindowTileItem: TMenuItem;
  19.     WindowArrangeItem: TMenuItem;
  20.     HelpAboutItem: TMenuItem;
  21.     OpenDialog: TOpenDialog;
  22.     FileSaveItem: TMenuItem;
  23.     FileSaveAsItem: TMenuItem;
  24.     Edit1: TMenuItem;
  25.     CutItem: TMenuItem;
  26.     CopyItem: TMenuItem;
  27.     PasteItem: TMenuItem;
  28.     WindowMinimizeItem: TMenuItem;
  29.     StatusBar: TStatusBar;
  30.     ActionList1: TActionList;
  31.     EditCut1: TEditCut;
  32.     EditCopy1: TEditCopy;
  33.     EditPaste1: TEditPaste;
  34.     FileNew1: TAction;
  35.     FileSave1: TAction;
  36.     FileExit1: TAction;
  37.     FileOpen1: TAction;
  38.     FileSaveAs1: TAction;
  39.     WindowCascade1: TWindowCascade;
  40.     WindowTileHorizontal1: TWindowTileHorizontal;
  41.     WindowArrangeAll1: TWindowArrange;
  42.     WindowMinimizeAll1: TWindowMinimizeAll;
  43.     HelpAbout1: TAction;
  44.     FileClose1: TWindowClose;
  45.     WindowTileVertical1: TWindowTileVertical;
  46.     WindowTileItem2: TMenuItem;
  47.     ToolBar2: TToolBar;
  48.     ToolButton1: TToolButton;
  49.     ToolButton2: TToolButton;
  50.     ToolButton3: TToolButton;
  51.     ToolButton4: TToolButton;
  52.     ToolButton5: TToolButton;
  53.     ToolButton6: TToolButton;
  54.     ToolButton9: TToolButton;
  55.     ToolButton7: TToolButton;
  56.     ToolButton8: TToolButton;
  57.     ToolButton10: TToolButton;
  58.     ToolButton11: TToolButton;
  59.     ImageList1: TImageList;
  60.     SkinData1: TSkinData;
  61.     Option1: TMenuItem;
  62.     order11: TMenuItem;
  63.     order12: TMenuItem;
  64.     procedure FileNew1Execute(Sender: TObject);
  65.     procedure FileOpen1Execute(Sender: TObject);
  66.     procedure HelpAbout1Execute(Sender: TObject);
  67.     procedure FileExit1Execute(Sender: TObject);
  68.   private
  69.     { Private declarations }
  70.     procedure CreateMDIChild(const Name: string);
  71.   public
  72.     { Public declarations }
  73.   end;
  74. var
  75.   MainForm: TMainForm;
  76. implementation
  77. {$R *.dfm}
  78. uses CHILDWIN, about;
  79. procedure TMainForm.CreateMDIChild(const Name: string);
  80. var
  81.   Child: TMDIChild;
  82. begin
  83.   { create a new MDI child window }
  84.   Child := TMDIChild.Create(Application);
  85.   Child.Caption := Name;
  86.   if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
  87. //  skindata1.UpdateMainMenu(true);
  88. end;
  89. procedure TMainForm.FileNew1Execute(Sender: TObject);
  90. begin
  91.   CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
  92. end;
  93. procedure TMainForm.FileOpen1Execute(Sender: TObject);
  94. begin
  95.   if OpenDialog.Execute then
  96.     CreateMDIChild(OpenDialog.FileName);
  97. end;
  98. procedure TMainForm.HelpAbout1Execute(Sender: TObject);
  99. begin
  100.   AboutBox.ShowModal;
  101. end;
  102. procedure TMainForm.FileExit1Execute(Sender: TObject);
  103. begin
  104.   Close;
  105. end;
  106. end.