منتدى تعليمي
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

انشاء المكون TLabel برمجيا وتغيير الااوان

اذهب الى الأسفل

انشاء المكون  TLabel  برمجيا وتغيير الااوان Empty انشاء المكون TLabel برمجيا وتغيير الااوان

مُساهمة من طرف salme السبت يناير 21, 2017 4:11 pm

انشاء المكون TLabel برمجيا وتغيير الااوان



الكود:


type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure CliqueLabel1(Sender: TObject);
  private public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses StdCtrls;

var
  Label1: TLabel;

procedure TForm1.CliqueLabel1(Sender: TObject);
begin

  Label1.AutoSize := false;
  Label1.Alignment := taCenter;
  Label1.Left := Label1.Left + Label1.Width;
  if Label1.Left <= Form1.Width then
  begin
      Label1.Top := 20;
      Label1.Height := 15;
      Label1.Width := 50;
  end
  else
      Label1.Left := 20;

    if Label1.Color = clRed then
    begin
    Label1.Color := clGreen;
    Label1.Font.Color := clRed;
    Label1.Caption := '1954';
    end
    else if Label1.Color = clGreen then
    begin
    Label1.Color := clWhite;
    Label1.Font.Color := clGreen;
    Label1.Caption := '1962';
    end
    else
    begin
    Label1.Color := clRed;
    Label1.Font.Color := clWhite;
    Label1.Caption := '2016';
  end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin

  Label1 := TLabel.Create(self);
  Label1.Parent := Form1;
  Label1.AutoSize := false;
  Label1.Cursor := crHandPoint;
  Label1.Left := 20;
  Label1.Top := 20;
  Label1.Height := 15;
  Label1.Width := 50;
  Label1.Color := clRed;
  Label1.Font.Color := clGreen;
  Label1.Alignment := taCenter; // taLeftJustify taRightJustify
  Label1.Caption := '1962';
  Label1.OnClick := CliqueLabel1;

end;


المصدر دلفي تعليم
delph.forumalgerie.net

salme
Admin

المساهمات : 38
تاريخ التسجيل : 20/01/2017

https://elf1.rigala.net

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة

- مواضيع مماثلة

 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى