المشاركات : 33
المواضيع 17
:
: 3
الإنتساب : Sep 2024
السلام عليكم
كيف افعل ProgressBar1 عند تنفيد البرنامج في النسخ او الطباعة او اي شي يحتاج وقت
المشاركات : 628
المواضيع 72
:
: 209
الإنتساب : Jun 2010
09-03-2025, 10:08 AM
(آخر تعديل لهذه المشاركة: 09-03-2025, 10:08 AM بواسطة لؤي.)
السلام عليكم
مثال عام :
PHP كود :
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls;
type
TForm1 = class(TForm)
ProgressBar1: TProgressBar;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
ProgressBar1.Position := 0; // Reset progress bar
ProgressBar1.Max := 100; // Set max value
for i := 1 to 100 do
begin
Sleep(50); // Simulate a process (e.g., printing, calculation)
ProgressBar1.Position := i; // Update progress bar
Application.ProcessMessages; // Keep UI responsive
end;
ShowMessage('Process Completed!');
end;
end.
مثال على الطبع :
PHP كود :
procedure TForm1.PrintDocument;
var
i: Integer;
begin
Printer.BeginDoc;
ProgressBar1.Position := 0;
ProgressBar1.Max := 10; // بافتراض 10 خطوات في عملية الطباعة
for i := 1 to 10 do
begin
Sleep(200);// محاكاة تأخير الطباعة
ProgressBar1.Position := i;
Application.ProcessMessages;
end;
Printer.EndDoc;
ShowMessage('Printing Complete!');
end;
أدبني الدهر فأراني نقص عقلي وإذا ما ازددت علما زادني علما بجهلي
كل من 1 user says قال شكرا ل لؤي على المشاركة المفيدة1 user says Thank You to لؤي for this post
• سليم 2024
المشاركات : 33
المواضيع 17
:
: 3
الإنتساب : Sep 2024
شكرا لك وجزاك الله خيرا علي المساعدة