انشاء عنصر TPanel وداخل هذا العنصر ننشيء عنصر TButton
صفحة 1 من اصل 1
انشاء عنصر TPanel وداخل هذا العنصر ننشيء عنصر TButton
بسم الله الرحمن الرحيم
الصلاة والسلام على رسول الله وعلى آله وصحبه أجمعين
انشاء عنصر TPanel وداخل هذا العنصر ننشيء عنصر TButton
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
/// داخل class TForm نصرح بالاجراء تابع لحدث نقر ثم نضغط فوق المفاتيح الثلاث ctrl+shift+c من أجل
/// أن يضاف الاجراء تلقائيا في جسم الوحدة
procedure TestButton1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
/// نستعمل أو نستدعي
/// هذه الوحدة من أجل العنصر
/// TPanel
ExtCtrls,
/// نستعمل أو نستدعي
/// هذه الوحدة من أجل العنصر
/// TButton
StdCtrls;
var
/// نصرح بعنصر من نوع
/// TPanel
TestPanel1 :TPanel;
/// نصرح بعنصر من نوع
/// TButton
TestButton1 :TButton;
procedure TForm1.TestButton1Click(Sender: TObject);
begin
/// نكتب الاوامر او تعليمات التي سوف تنفذ
Form1.Caption := '2018';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
/// ننشيء عنصر من نوع
/// TPanel
TestPanel1 := TPanel.Create(self);
/// مكان ظهور هذا العنصر
/// Form1
TestPanel1.Parent := Form1;
/// اظهر هذا العنصر عند رقم 50 من جهة اليسار
TestPanel1.Left := 50;
/// ارتفاع العنصر 50
TestPanel1.Top := 50;
/// طول العنصر
TestPanel1.Width := 450;
/// عرض العنصر
TestPanel1.Height := 250;
/// ننشيء عنصر من نوع
/// TButton
TestButton1 := TButton.Create(TestPanel1);
/// مكان ظهور هذا العنصر
/// TestPanel1
TestButton1.Parent := TestPanel1;
/// اظهر هذا العنصر عند رقم 50 من جهة اليسار
TestButton1.Left := 50;
/// ارتفاع العنصر 50
TestButton1.Top := 50;
/// طول العنصر
TestButton1.Width := 100;
/// عرض العنصر
TestButton1.Height := 45;
/// العبارة التي تظهر على العنصر
TestButton1.Caption := 'Clique ici';
/// الحدث الذي سينفذ عند النقر على العنصر
TestButton1.OnClick := TestButton1Click;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
/// نحرر الذاكرة من العناصر التي أنشأناها
TestButton1.Free;
TestPanel1.Free;
end;
- الكود:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure TestButton1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
ExtCtrls, StdCtrls;
var
TestPanel1 :TPanel;
TestButton1 :TButton;
procedure TForm1.TestButton1Click(Sender: TObject);
begin
Form1.Caption := '2018';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TestPanel1 := TPanel.Create(self);
TestPanel1.Parent := Form1;
TestPanel1.Left := 50;
TestPanel1.Top := 50;
TestPanel1.Width := 450;
TestPanel1.Height := 250;
TestButton1 := TButton.Create(TestPanel1);
TestButton1.Parent := TestPanel1;
TestButton1.Left := 50;
TestButton1.Top := 50;
TestButton1.Width := 200;
TestButton1.Height := 45;
TestButton1.Caption := 'Clique ici';
TestButton1.OnClick := TestButton1Click;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
TestButton1.Free;
TestPanel1.Free;
end;
ali- مبرمج مجتهد
- عدد المساهمات : 913
تاريخ التسجيل : 29/07/2013
مواضيع مماثلة
» كيف ننشيء عنصر ActiveX من نوع pdf
» كيف نضع على الفورم عدة نسخ من نفس العنصر أو المركب
» كيف ستأخذ أي صورة شكل العنصر TImage
» كيف يمكن جعل اي الصورة تأخذ شكل العنصر TImage
» إضافة عنصر تحكم ActiveX
» كيف نضع على الفورم عدة نسخ من نفس العنصر أو المركب
» كيف ستأخذ أي صورة شكل العنصر TImage
» كيف يمكن جعل اي الصورة تأخذ شكل العنصر TImage
» إضافة عنصر تحكم ActiveX
صفحة 1 من اصل 1
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى