Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#27

AW: Expandierendes Fenster - ist es überhaupt möglich?

  Alt 8. Jul 2019, 20:18
Setze deine form auf eine weite von 225, und höhe 150
Verwende den unten stehenden Code

Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    CheckBox1: TCheckBox;
    ListBox1: TListBox;
    ComboBox1: TComboBox;
    GroupBox1: TGroupBox;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton1: TRadioButton;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    procedure Explode;
    procedure Implode;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Explode;
begin

  repeat
    MoveWindow(Handle, Left - 3, Top - 2, Width + 6, Height + 4, true);
    application.ProcessMessages;
    sleep(10);
  until Top < 350

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin

  Implode;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Show;
  Explode;
end;

procedure TForm1.Implode;
var
  y: Integer;
begin
   y := GetSystemMetrics(SM_CYSCREEN) div 2;

   repeat
    MoveWindow(Handle, Left + 2, Top + 2, Width - 4, Height - 4, true);
    application.ProcessMessages;
    sleep(10);
  until Top > y

end;

end.
und fertig!

AnimateWindow ist unter Windows 10 einfach nur Müll. (In Verbindung mit kompletten Forms)
Ist nur ein einfaches Beispiel wie man es noch machen könnte.. geht bestimmt besser.
Falls das für dich mit AnimateWindow keine befriedigende Lösung ist.

PS:
Oder nimm den Anhang..

gruss

Geändert von EWeiss (11. Jul 2019 um 15:58 Uhr)
  Mit Zitat antworten Zitat