code_junkie

Delphi MDI Application and the titlebar of the MDI Children

Nov 10th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. unit CHILDWIN;
  2. interface
  3. uses Windows, Classes, Graphics, Forms, Controls, StdCtrls;
  4.  
  5. type
  6. TMDIChild = class(TForm)
  7. private
  8. { Private declarations }
  9. public
  10. { Public declarations }
  11. procedure CreateWindowHandle(const Params: TCreateParams); override;
  12. end;
  13.  
  14. implementation
  15.  
  16. {$R *.dfm}
  17. procedure TMDIChild.CreateWindowHandle(const Params: TCreateParams);
  18. begin
  19. inherited CreateWindowHandle(Params);
  20. SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
  21. end;
  22. end.
  23.  
  24. TMyForm = class(TForm)
  25. private
  26. FCurrentModule : TFrame;
  27. public
  28. property CurrentModule : TFrame read FModule write SetCurrentModule;
  29. end;
  30.  
  31. procedure TMyForm.SetCurrentModule(ACurrentModule : TFrame);
  32. begin
  33. if assigned(FCurrentModule) then
  34. FreeAndNil(FCurrentModule); // You could cache this if you wanted
  35. FCurrentModule := ACurrentModule;
  36. if assigned(FCurrentModule) then
  37. begin
  38. FCurrentModule.Parent := Self;
  39. FCurrentModule.Align := alClient;
  40. end;
  41. end;
  42.  
  43. MyForm.CurrentModule := TSomeFrame.Create(nil);
Add Comment
Please, Sign In to add comment