![]() |
|
تغيير الوان shapeضمن التايمر - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : تغيير الوان shapeضمن التايمر (/showthread.php?tid=6909) الصفحات:
1
2
|
تغيير الوان shapeضمن التايمر - rabihpascal - 30-03-2015 السلام عليكم ما هي اسهل طريقة لتغيير لون 4 shapeبالتتابع من خلال انترفال تايمر واحد تغيير الوان shapeضمن التايمر - الكاسر الآخر - 30-03-2015 دلفي xe2 كود : unit Unit15;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TForm15 = class(TForm)
Shape1: TShape;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form15: TForm15;
c : array [1..4] of Tcolor = (clred,clblue,clgreen,clwhite);
i : integer=1;
implementation
{$R *.dfm}
procedure TForm15.Timer1Timer(Sender: TObject);
begin
shape1.Brush.Color:=c[i];
i:=i+1;
if i=5 then i:=1;
end;
end.تغيير الوان shapeضمن التايمر - rabihpascal - 30-03-2015 اخي الكريم لدي اربع shape على بانل كيف يتغير لونهم واحد تلو الاخر الى اللون الاخضر من ضمن نفس الانترفال اي قبل ان ينتهي اول زمن تغيير الوان shapeضمن التايمر - الكاسر الآخر - 30-03-2015 يمكن من ضمن نفس الانترفال ان تستعمل دالة sleep ولكنها ليست بالحل الامثل لأنها تسبب في حدوث بطء في التنفيذ مثال ضع قيمة الانترفال 2500 كود : Shape1.Brush.Color := clGreen;
Shape1.Repaint;
sleep(500);
Shape2.Brush.Color := clGreen;
Shape2.Repaint;
sleep(500);
Shape3.Brush.Color := clGreen;
Shape3.Repaint;
sleep(500);
Shape4.Brush.Color := clGreen;
Shape4.Repaint;
sleep(500);
Shape1.Brush.Color := clWhite;
Shape2.Brush.Color := clWhite;
Shape3.Brush.Color := clWhite;
Shape4.Brush.Color := clWhite;تغيير الوان shapeضمن التايمر - karika2 - 01-04-2015 تابع كيف أستخدم تايمر واحد فى عدة احداث ..؟ تغيير الوان shapeضمن التايمر - Anew - 01-04-2015 rabihpascal كتب :اخي الكريم لدي اربع shape على بانل كيف يتغير لونهم واحد تلو الاخر الى اللون الاخضر من ضمن نفس الانترفال اي قبل ان ينتهي اول زمن استخدم هذا الكود في اي حدث كود : var
i : Integer;
begin
btn2.Enabled := False;
for i := 0 to 40 do
begin
Application.ProcessMessages;
Sleep(2);
case i of
0: begin
shp1.Brush.Color := clGreen;
shp2.Brush.Color := clWhite;
shp3.Brush.Color := clWhite;
shp4.Brush.Color := clWhite;
end;
10: begin
shp1.Brush.Color := clWhite;
shp2.Brush.Color := clGreen;
shp3.Brush.Color := clWhite;
shp4.Brush.Color := clWhite;
end;
20: begin
shp1.Brush.Color := clWhite;
shp2.Brush.Color := clWhite;
shp3.Brush.Color := clGreen;
shp4.Brush.Color := clWhite;
end;
30: begin
shp1.Brush.Color := clWhite;
shp2.Brush.Color := clWhite;
shp3.Brush.Color := clWhite;
shp4.Brush.Color := clGreen;
end;
end;
end;
btn2.Enabled := True;
end;تغيير الوان shapeضمن التايمر - Anew - 01-04-2015 كود : btn2.Enabled := False;هذه ما قبل لاجراء كود : btn2.Enabled := True;هذه ما بعد الاجراء تغيير الوان shapeضمن التايمر - S.FATEH - 01-04-2015 السلام عليكم لماذا لا تقسم الانترفال احسن ان كان 1000 تقسمه على 4 ؟ !! تغيير الوان shapeضمن التايمر - rabihpascal - 02-04-2015 السلام عليكم اولا اشكر الجميع لا يصح تقسيم الانترفال لانه يترافق مع ملف موسيقي بنفس الطول اما بخصوص sleepفانها تتسبب بتقطيع الصوت واحيانا اعتراض تغيير الوان shapeضمن التايمر - S.FATEH - 02-04-2015 يمكنك استخدام الـ thread وضح بالتفصيل ما تحاول فعله ما ترغب الوصول اليه محاولتك المشكلة و ما الى ذلك و ستجد اجابة ان شاء الله ... |