⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progress.pas

📁 用一个循环检查局域网段的每一个IP
💻 PAS
字号:
unit progress;

{*
 * Based on The Apache Software License, Version 1.1
 *
 *
 * Copyright (c) 2001 X-Watch Software, Sven K黱zler.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:  
 *       "This product includes software developed by
 *        X-Watch Software (http://www.xwatch.de/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Slider" and "X-Watch" must
 *    not be used to endorse or promote products derived from this
 *    software without prior written permission. For written
 *    permission, please contact svenk@gmx.net.
 *
 * 5. Products derived from this software may not be called "Slider",
 *    nor may "Slider" appear in their name, without prior written
 *    permission of X-Watch Software.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL X-WATCH SOFTWARE OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm2 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Button1: TButton;
    Timer1: TTimer;
    Image1: TImage;
    Label6: TLabel;
    LabelTime: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormHide(Sender: TObject);
  private
    { Private-Deklarationen }
    Ani: Array[1..8] of TBitmap;
    aniCounter: Integer;
    fOnCancel: TNotifyEvent;
    fStartTime: TDateTime;
  public
    { Public-Deklarationen }
    Procedure StartProgress;
    Procedure StopProgress;
    Property OnCancel: TNotifyEvent read fOnCancel write fOnCancel;
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}
{$R ANI.RES}

procedure TForm2.Button1Click(Sender: TObject);
begin
     Hide;
     if Assigned(fOnCancel) Then fOnCancel(Self);
end;

procedure TForm2.FormCreate(Sender: TObject);
var i: Integer;
begin
     aniCounter:=1;
     For i:=1 To 8 Do
     Begin
          Ani[i]:=TBitmap.Create;
          Ani[i].LoadFromResourceName(hInstance,'ANI'+IntToStr(i));
     End;
end;

procedure TForm2.FormDestroy(Sender: TObject);
var i: Integer;
begin
     For i:=1 To 7 Do Ani[i].Free;
end;

procedure TForm2.Timer1Timer(Sender: TObject);
begin
      Image1.Picture.Bitmap:=Ani[aniCounter];
      aniCounter:=aniCounter Mod 8 + 1;
      LabelTime.Caption:=TimeToStr(Time-fStartTime);
end;

procedure TForm2.FormShow(Sender: TObject);
begin
     StartProgress;
     Timer1Timer(Self);
end;

procedure TForm2.FormHide(Sender: TObject);
begin
     StopProgress;
end;

procedure TForm2.StartProgress;
Begin
     Timer1.Enabled:=True;
     Button1.Caption:='Cancel';
     fStartTime:=Time;
End;

procedure TForm2.StopProgress;
Begin
     Timer1.Enabled:=False;
     Button1.Caption:='Close';
End;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -