gpt4 book ai didi

delphi - 为什么我的 Delphi 2006 应用程序的任务栏按钮上下文菜单不完整?

转载 作者:行者123 更新时间:2023-12-03 18:16:45 25 4
gpt4 key购买 nike

当我在 Delphi 2006 中创建一个新的 VCL 应用程序并运行它时(没有添加任何我自己的代码或引用我自己的任何单元),该应用程序不会在上下文菜单中包含人们期望的所有菜单项它的任务栏按钮。但是,应用程序的系统菜单(左键单击窗体图标时出现的菜单)具有所有常规菜单项。正如您在以下屏幕截图中所见,Move ( Verschieben ), Size ( Größe ändern ) 和 Maximize ( Maximieren ) 缺少前者

enter image description here enter image description here

我无法在 Delphi XE(我可以访问的唯一其他 Delphi 版本)中重现此问题,而且我也没有发现任何其他人报告此行为。

我还查看了 TForm 的属性和 TApplication是否有一个可以控制这些菜单,但没有找到。

我知道的所有应用程序在这两个菜单中都有相同的菜单项集,我希望我的应用程序也这样做。如何让这两个菜单显示同一组项目?

最佳答案

区别在于Application.MainFormOnTaskBar ,一个在 D2007 中引入的属性,自动设置为 True。

为了在早期版本中获得相同的效果,我总是使用以下方法:

项目.dpr:

uses
Windows,
...

Application.CreateForm(TMainForm, MainForm);
ShowWindow(Application.Handle, SW_HIDE);
Application.Run;

FMain.pas:

  TMainForm = class(TForm)
private
procedure WMSysCommand(var Message: TWMSysCommand);
message WM_SYSCOMMAND;
protected
procedure CreateParams(var Params: TCreateParams); override;
...

procedure TMainForm.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
begin
ExStyle := ExStyle or WS_EX_APPWINDOW;
WndParent := GetDesktopWindow;
end;
end;

procedure TMainForm.WMSysCommand(var Message: TWMSysCommand);
begin
if Message.CmdType = SC_MINIMIZE then
ShowWindow(Handle, SW_MINIMIZE)
else
inherited;
end;

这仅在设计时 MainForm.Visible 设置为 True 时有效。

关于delphi - 为什么我的 Delphi 2006 应用程序的任务栏按钮上下文菜单不完整?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10151677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com