Einzelnen Beitrag anzeigen

OLDIE1950

Registriert seit: 2. Jan 2018
22 Beiträge
 
#12

AW: Ausgabe verzögern

  Alt 24. Okt 2018, 20:00
Mit DELPHI XE7

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)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// https://www.delphipraxis.net/6620-delay.html
procedure Delay(msecs: Longint);
var
  targettime: Longint;
  Msg: TMsg;
begin
  targettime := GetTickCount + msecs;
  while targettime > GetTickCount do
    if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
    begin
      if Msg.message = WM_QUIT then
      begin
        PostQuitMessage(Msg.wParam);
        Break;
      end;
      TranslateMessage(Msg);
      DispatchMessage(Msg);
    end;
end;


procedure TForm1.Button1Click(Sender: TObject);
  var a, h, Af, U : Real;
begin
  a:= strtofloat(Edit1.Text);
  h:= a/2*sqrt(3);
  Af := (a*a);
  Af := Af/4;
  Af := Af*sqrt(3);
  U := 3*a;
  Delay(500);
  Edit2.Text := floattostr(Af);
  Delay(500);
  Edit3.Text := floattostr(U);
  Delay(500);
  Edit4.Text := floattostr(h);
end;

end.
Angehängte Dateien
Dateityp: 7z Project1.7z (609,5 KB, 5x aufgerufen)
  Mit Zitat antworten Zitat