
22.10.2010, 23:15
|
Новичок
|
|
Регистрация: 03.02.2010
Сообщения: 64
Репутация: 133
|
|
Цитата:
Сообщение от x128
Событие OnProgress
|
из справки (Delphi 7):
Цитата:
OnProgress event (TImage)
Occurs periodically during slow operations that affect the image.
Delphi syntax:
property OnProgress: TProgressEvent;
Description
Write an OnProgress event handler to provide the user with feedback during slow operations such as loading large compressed images.
|
Цитата:
TProgressEvent type
TProgressEvent is the type of event handlers that provide feedback during lengthy operations.
Unit
Graphics
Delphi syntax:
type TProgressEvent = procedure (Sender: TObject; Stage: TProgressStage; PercentDone: Byte; RedrawNow: Boolean; const R: TRect; const Msg: string
) of object;
|
пример:
Код:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
procedure TForm1.Image1Progress(Sender: TObject; Stage: TProgressStage;
PercentDone: Byte; RedrawNow: Boolean; const R: TRect; const Msg: string);
begin
ProgressBar1.Position:=PercentDone;
label1.Caption:=IntToStr(PercentDone)+'%';
Application.ProcessMessages;
end;
|