首页 > 解决方案 > 创新设置。如何用鼠标移动窗口?

问题描述

在 Inno Setup 中,我用公式删除了窗口的边框

WizardForm.BorderStyle: = bsNone; (效果很好。)

目前,我想用鼠标移动窗口。我在 Lazarus 下编写了这段代码,它工作正常,但是如果我在 Inno Setup 中应用相同的代码,它就不起作用。请您帮帮我,因为我找不到解决方案。谢谢你。

[Code]
procedure InitializeWizard();

//Remove the border of the window.
var
  ClientWidth: Integer;
  ClientHeight: Integer;

begin
  ClientWidth := WizardForm.ClientWidth;
  ClientHeight := WizardForm.ClientHeight;

  WizardForm.BorderStyle := bsNone;

  WizardForm.ClientWidth := ClientWidth;
  WizardForm.ClientHeight := ClientHeight;   
end;

//Move the window with the mouse.
var
  MouseIsDown: boolean;
  PX, PY: integer;

procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbLeft then
  begin
    MouseIsDown := True;
    PX := X;
    PY := Y;
  end;
end;

procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if MouseIsDown then
  begin
    SetBounds(Left + (X - PX), Top + (Y - PY), Width, Height);
  end;
end;

procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  MouseIsDown:=False;
end;

end.

procedure DeInitializeSetup();
begin
end;

// End of file (EOF)

标签: pascal

解决方案


Inno Setup - 用鼠标移动窗口。

大家好,

当我们移除窗口的边框时,必须能够用鼠标移动它。
我把解决方案发给你:
要做到这一点,你必须使用 Inno Setup 和 Graphical Installer。
下载最新版本很重要。

以下是链接:
Inno 设置:http
://www.jrsoftware.org/ 图形安装程序:http: //graphical-installer.com/joomla/index.php/purchase/free-trial

1 / 安装 2 个应用程序。
2 / 复制下面的代码并将其粘贴到 Inno Setup 的代码部分(您的脚本)中。
3 / 运行。

[Code]
// Next functions are used for proper working of Graphical Installer powered installer
procedure InitializeWizard();

//This function allows you to delete the border of the window
var
  ClientWidth: Integer;
  ClientHeight: Integer;
begin
  ClientWidth := WizardForm.ClientWidth;
  ClientHeight := WizardForm.ClientHeight;

  WizardForm.BorderStyle := bsNone;

  WizardForm.ClientWidth := ClientWidth;
  WizardForm.ClientHeight := ClientHeight;

//This function allows you to drag the window with the mouse
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    WizardForm.EnableDragging();
    #endif
end;

    #ifdef GRAPHICAL_INSTALLER_PROJECT
    InitGraphicalInstaller();
    #endif
end;

// Next function is used for proper working of Graphical Installer powered installer
procedure CurPageChanged(CurPageID: Integer);
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    PageChangedGraphicalInstaller(CurPageID);
    #endif
end;

// Next function is used for proper working of Graphical Installer powered installer 
procedure DeInitializeSetup();
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    DeInitGraphicalInstaller();
    #endif
end;

// End of file (EOF)

重要提示:
移动窗口只能通过将鼠标光标定位在窗口底部来激活。
您可以在 Graphical Installer 的在线手册中阅读此功能。
(请参阅页面底部的标题“拖动安装窗口”。)

这是链接: http:
//graphical-installer.com/files/manuals/inno/source/html/intro%20-%20project-api.html

好剧本给大家。


推荐阅读