mainmdi.cpp
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "mainmdi.h"
  5. #include "About.h"
  6. #include "childwin.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma link "fcButtonGroup"
  10. #pragma link "fcClearPanel"
  11. #pragma resource "*.dfm"
  12. TMainMdiForm *MainMdiForm;
  13. //---------------------------------------------------------------------------
  14. __fastcall TMainMdiForm::TMainMdiForm(TComponent* Owner)
  15.         : TForm(Owner)
  16. {
  17. }
  18. //---------------------------------------------------------------------------
  19. void __fastcall TMainMdiForm::SetMDIChildCaption(TCustomForm * Child, String Name)
  20. {
  21.   Child->Caption = Name;
  22.   ((TfcShapeBtn *)(fcButtonGroup1->ButtonItems->FindPointerTag(Child)->Button))->Caption = Name;
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TMainMdiForm::CreateMDIChild(const String Name)
  26. {
  27.   TMDIChild * Child;
  28.   Child = new TMDIChild(Application);
  29.   SetMDIChildCaption(Child, Name);
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TMainMdiForm::FileExitItemClick(TObject *Sender)
  33. {
  34. Close();
  35. }
  36. //---------------------------------------------------------------------------
  37. void __fastcall TMainMdiForm::ToolButton10Click(TObject *Sender)
  38. {
  39.  Tile();
  40. }
  41. //---------------------------------------------------------------------------
  42. void __fastcall TMainMdiForm::ToolButton8Click(TObject *Sender)
  43. {
  44.  Cascade();
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TMainMdiForm::FileCloseItemClick(TObject *Sender)
  48. {
  49.   if (ActiveMDIChild != NULL)
  50.      ActiveMDIChild->Close();
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TMainMdiForm::FileNewItemClick(TObject *Sender)
  54. {
  55.   CreateMDIChild("FORM" + IntToStr(MDIChildCount + 1));
  56. }
  57. //---------------------------------------------------------------------------
  58. void __fastcall TMainMdiForm::FormActivate(TObject *Sender)
  59. {
  60.   FileNewItemClick(Sender);
  61. }
  62. //---------------------------------------------------------------------------
  63. void __fastcall TMainMdiForm::fcButtonGroup1Change(
  64.       TfcCustomButtonGroup *ButtonGroup, TfcButtonGroupItem *OldSelected,
  65.       TfcButtonGroupItem *Selected)
  66. {
  67.   ((TCustomForm *)(Selected->PointerTag))->Show();
  68. }
  69. //---------------------------------------------------------------------------