delphi4arab منتديات دلفي للعرب

نسخة كاملة : كيف نضع نص متحرك text مثل الاعلان داخل edt
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم

ماهو الكود الذي يقوم بهذا العمل

تحريك text مثل الاعلان داخل edt عن طريق التايمر
من اليسار الى اليمين ويرجع مرة اخرى النص من اليسار ( نص متحرك )
و عليكم السلام

أستخدمت مثال و لكن بـ Label أظنه أفضل من edit
كود :
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Label1: TLabel; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } function droite (i:Integer):string; function gauche (i:Integer):string; public { Public declarations } end; var Form1: TForm1; v:Integer; implementation {$R *.dfm} function tform1.droite (i:Integer):string; begin if Label1.Left < 350 then label1.Left:=Label1.Left +5 else v:=250; end; function tform1.gauche (i:Integer):string; begin if Label1.Left > 100 then label1.Left:=Label1.Left -5 else v:=200; end; procedure TForm1.Timer1Timer(Sender: TObject); begin case v of 200 : droite(200); 250 : gauche(250); end; end; procedure TForm1.FormCreate(Sender: TObject); begin v:=200; end; end.
ما عليك إلا أن تضبط البارمتر من اليمين إلى اليسار
بالتوفيق
او إستعمال مكون Text Animator Component

كود :
http://www.delphiarea.com/downloads/?dl_id=7

بالتوفيق
السلام عليكم ورحمة الله
أنظر هذا الموضوع
http://www.delphi4arab.net/forum/showthr...ight=label
بالتوفيق
السلام عليكم لم اجربها فكرة جميلة Cool

PHP كود :
unit Unit1;

interface

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

type
  TForm1 
= class(TForm)
    
Label1: TLabel;
    
procedure FormCreate(Sender: TObject);
  private
    
i: Integer;
    
procedure Timing1(Sender: TObject);
    
procedure Timing2(Sender: TObject);
  public
    { Public 
declarations }
  
end;

var
  
Form1: TForm1;

implementation

uses ExtCtrls
;

{
$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  
Timer: TTimer;
begin
  i 
:= 1;
  
Timer          := TTimer.Create(Self);
  
Timer.Interval := 10;
  
Timer.OnTimer  := Timing1;
  
// or Timer.OnTimer  := Timing2;
end;

procedure TForm1.Timing1(Sender: TObject);
begin
  
if Label1.Left <> ClientWidth then Label1.Left := Label1.Left + 1 else
  
Label1.Left := 0;
end;

procedure TForm1.Timing2(Sender: TObject);
begin
  
if ((Label1.Left = ClientWidth) or (Label1.Left = 0))then i := -i;
  
Label1.Left := Label1.Left + i;
end;

end. 

طريقة العرض الاولى عند الوصول الى الحافة تعود من الصفر
طريقة العرض الثانية عند الوصول الى الحافة تعود ادراجها

Label على form1
لاضهار الكتابة بشكل متقطع انسخ الكود على Form1 و اضف label فارغة
PHP كود :
unit Unit1;

interface

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

type
  TForm1 
= class(TForm)
    
Label1: TLabel;
    
procedure FormCreate(Sender: TObject);
  private
    
i: Integer;
    
procedure Timing(Sender: TObject);
  public
    { Public 
declarations }
  
end;

var
  
Form1: TForm1;

implementation

uses ExtCtrls
;

{
$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  
Timer: TTimer;
begin
  i 
:= 0;
  
Label1.Caption := EmptyStr;
  
Timer := TTimer.Create(Self);
  
Timer.Interval := 100;
  
Timer.OnTimer  := Timing;
end;

procedure TForm1.Timing(Sender: TObject);
var
  
s: string;
begin
  s 
:= 'Delphi4Arab|S.FATEH';
  
Label1.Caption := Label1.Caption + s[i];
  
Inc(i);
  if 
Length(Label1.Caption)-1 = Length(s) then
  begin
    i 
:= 0;
    
Label1.Caption := '';
  
end;

end;

end. 
السلام عليكم ورحمة الله تعالى وبركاته

فى هذا الرابط تجد مثال فيه الكتابة تتحرك تكون في ملف نص كنت قد ادرجته من قبل

http://delphi4arab.net/forum/showthread.php?tid=7108
ضع لابل وافعل مالي.
كود :
repeat label1.left:=label1.left+1; until label1.left=form1.width+1; label1.left:=0; end;