Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi MDI应用程序和MDI子级标题栏_Delphi_Forms_Mdi - Fatal编程技术网

Delphi MDI应用程序和MDI子级标题栏

Delphi MDI应用程序和MDI子级标题栏,delphi,forms,mdi,Delphi,Forms,Mdi,我有一个用Delphi2006编写的MDI应用程序,它以默认主题运行XP 有没有办法控制MDI子项的外观,以避免每个窗口上出现大型XP样式的标题栏 我已尝试将MDIChildren的BorderStyle设置为bsSizeToolWin,但它们仍然呈现为正常形式;根据我的经验,Delphi中的MDI受到其在VCL中的实现的严格限制和控制(可能还受到Windows API的限制)。例如,不要尝试隐藏MDI子菜单(如果尝试,会出现异常,并且必须跳过几个API环才能解决此问题),也不要更改MDI子菜单

我有一个用Delphi2006编写的MDI应用程序,它以默认主题运行XP

有没有办法控制MDI子项的外观,以避免每个窗口上出现大型XP样式的标题栏


我已尝试将
MDIChildren
BorderStyle
设置为
bsSizeToolWin
,但它们仍然呈现为正常形式;根据我的经验,Delphi中的MDI受到其在VCL中的实现的严格限制和控制(可能还受到Windows API的限制)。例如,不要尝试隐藏MDI子菜单(如果尝试,会出现异常,并且必须跳过几个API环才能解决此问题),也不要更改MDI子菜单与宿主窗体主菜单合并的方式

考虑到这些限制,也许你应该重新考虑一下为什么你首先想要有特殊的标题栏?我想也有很好的理由来解释为什么MDI是标准化的——您的用户可能会喜欢它:)

(注:很高兴在这里看到一个德尔菲问题!)

谢谢你

不幸的是,客户端坚持使用MDI和较小的标题栏


我找到了一种方法,通过覆盖windows CreateParams来隐藏标题栏,然后创建我自己的标题栏(带有一些移动鼠标操作的简单面板)。工作得足够好,所以我想我可以让客户端运行它,看看它是否会运行…

MDI的工作方式与您尝试的工作方式不一致

如果您需要“MDI”格式,您应该考虑使用内置或对接包,并使用对接设置来模仿MDI感觉。p> 在我的Delphi应用程序中,我经常使用TFrame并将其作为主窗体的父窗体,并最大化它们,使它们占据客户端区域。这将为您提供与Outlook相似的外观。有点像这样:

TMyForm = class(TForm)
private
  FCurrentModule : TFrame;
public
  property CurrentModule : TFrame read FModule write SetCurrentModule;
end;

procedure TMyForm.SetCurrentModule(ACurrentModule : TFrame);
begin
  if assigned(FCurrentModule) then
    FreeAndNil(FCurrentModule);  // You could cache this if you wanted
  FCurrentModule := ACurrentModule;
  if assigned(FCurrentModule) then
  begin
    FCurrentModule.Parent := Self;
    FCurrentModule.Align := alClient;
  end;
end;
unit CHILDWIN;
interface
uses Windows, Classes, Graphics, Forms, Controls, StdCtrls;

type
  TMDIChild = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateWindowHandle(const Params: TCreateParams); override;
  end;

implementation

{$R *.dfm}
procedure TMDIChild.CreateWindowHandle(const Params: TCreateParams);
begin
  inherited CreateWindowHandle(Params);
  SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;
end.
要使用它,您只需执行以下操作:

MyForm.CurrentModule := TSomeFrame.Create(nil);
有一个很好的论点是您应该使用您使用的接口(创建IModule接口或其他东西)。我经常这样做,但这比在这里解释这个概念要复杂得多


HTH

所有您需要的-重载过程CreateWindowHandle,如下所示:

TMyForm = class(TForm)
private
  FCurrentModule : TFrame;
public
  property CurrentModule : TFrame read FModule write SetCurrentModule;
end;

procedure TMyForm.SetCurrentModule(ACurrentModule : TFrame);
begin
  if assigned(FCurrentModule) then
    FreeAndNil(FCurrentModule);  // You could cache this if you wanted
  FCurrentModule := ACurrentModule;
  if assigned(FCurrentModule) then
  begin
    FCurrentModule.Parent := Self;
    FCurrentModule.Align := alClient;
  end;
end;
unit CHILDWIN;
interface
uses Windows, Classes, Graphics, Forms, Controls, StdCtrls;

type
  TMDIChild = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateWindowHandle(const Params: TCreateParams); override;
  end;

implementation

{$R *.dfm}
procedure TMDIChild.CreateWindowHandle(const Params: TCreateParams);
begin
  inherited CreateWindowHandle(Params);
  SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;
end.