Graphical progress Bar for Delphi application
reference : http://delphi.about.com/od/delphitips2008/qt/image-progress.htm
When your application performs a time-consuming operation, you can use a progress bar, the TProgressBar Delphi control, to show how much of the task is completed.
When you do not know how many steps are needed for a progress bar – you might want to display a continuous bar – or a moving graphical object. The UpdateImageProgress takes a reference to a TImage control displaying a picture. By calling the procedure from inside, for example, a timer event (TTimer control), a graphical progress effect is achieved.
The UpdateImageProgress shifts the image to the right – using the boundaries of the image – thus creating a continuous progress bar.
//”moves” image to the right in “step” steps
procedure UpdateImageProgress(const img : TImage) ;
const
step = 4;
var
b : TBitmap;
begin
with img.Picture.Bitmap do
begin
b := TBitmap.Create;
try
b.Width := Width;
b.Height := Height;
BitBlt(b.Canvas.Handle, step, 0, Width-step, Height, Canvas.Handle, 0, 0, SRCCOPY) ;
BitBlt(b.Canvas.Handle, 0, 0, step, Height, Canvas.Handle, Width-step, 0, SRCCOPY) ;
Assign(b) ;
finally
FreeAndNil(b) ;
end;
end;
end;
UpdateImageProgress shifts the trailing “step” part of the bitmap to the front, moving the rest along.
Blog Stats
- 18,765 hits
Archives
- February 2016 (1)
- August 2015 (1)
- November 2014 (1)
- July 2014 (1)
- February 2014 (4)
- January 2014 (3)
- October 2012 (1)
- September 2012 (1)
- May 2011 (1)
- April 2011 (1)
- February 2011 (1)
- January 2011 (1)
- December 2010 (1)
- November 2010 (4)
- October 2010 (1)
- August 2010 (1)
- July 2010 (3)
- September 2008 (9)
Recent Posts
- How to use makecert.exe to create a self-signed test certificate that can be used with IIS for SSL
- how do i limit the number of rows returned by an oracle query after ordering
- Getting the space left on the DEFAULT_TABLESPACE of the logged user
- CREATE USER WITH TABLESPACE in the ORACLE
- Delete File C#
Most Popular
- How to use makecert.exe to create a self-signed test certificate that can be used with IIS for SSL
- how do i limit the number of rows returned by an oracle query after ordering
- Getting the space left on the DEFAULT_TABLESPACE of the logged user
- CREATE USER WITH TABLESPACE in the ORACLE
- Delete File C#
- Encrypt & Decrypt File C#
- C# Saving any File to database SQL Server
- How to kill user session in oracle
- get the sequence have created
- view trigger on table
Categories
- C# (3)
- Delphi (7)
- API (1)
- error (1)
- Mouse (1)
- Progress bar (1)
- screen shot (1)
- Excel (3)
- Jaringan (1)
- Lingkungan (2)
- Math (1)
- Oracle (6)
- paypal (1)
- SQL Server (5)
- SSL (1)
- Uncategorized (7)