كيفية برمجة محرر بسيط بدلفي

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

كيفية برمجة محرر بسيط بدلفي

مُساهمة  ali1 في 5/3/2016, 9:15 pm

بسم الله الرحمن الرحيم
كيفية برمجة محرر بسيط بدلفي

الكود:
program Bloc_Note;{delph.forumalgerie.net}

uses
  Forms,
  Bloc in 'Bloc.pas' {Form1};{delph.forumalgerie.net}

{$R *.RES}

begin
  Application.Initialize;{delph.forumalgerie.net}
  Application.CreateForm(TForm1, Form1);{delph.forumalgerie.net}
  Application.Run;{delph.forumalgerie.net}
end.

_________________
[ندعوك للتسجيل في المنتدى أو التعريف بنفسك لمعاينة هذا الرابط]

ali1
مبرمج مجتهد

عدد المساهمات : 860
تاريخ التسجيل : 29/07/2013

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

رد: كيفية برمجة محرر بسيط بدلفي

مُساهمة  ali1 في 5/3/2016, 9:17 pm


الكود:
unit Bloc;{delph.forumalgerie.net}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Menus, ExtCtrls, ComCtrls;{delph.forumalgerie.net}

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;{delph.forumalgerie.net}
    file1: TMenuItem;{delph.forumalgerie.net}
    new1: TMenuItem;{delph.forumalgerie.net}
    open1: TMenuItem;{delph.forumalgerie.net}
    save1: TMenuItem;{delph.forumalgerie.net}
    saveas1: TMenuItem;{delph.forumalgerie.net}
    N1: TMenuItem;{delph.forumalgerie.net}
    exit1: TMenuItem;{delph.forumalgerie.net}
    edit1: TMenuItem;{delph.forumalgerie.net}
    cut1: TMenuItem;{delph.forumalgerie.net}
    copy1: TMenuItem;{delph.forumalgerie.net}
    past1: TMenuItem;{delph.forumalgerie.net}
    N2: TMenuItem;{delph.forumalgerie.net}
    select1: TMenuItem;{delph.forumalgerie.net}
    clear1: TMenuItem;{delph.forumalgerie.net}
    help1: TMenuItem;{delph.forumalgerie.net}
    Memo1: TMemo;{delph.forumalgerie.net}
    OpenDialog1: TOpenDialog;{delph.forumalgerie.net}
    SaveDialog1: TSaveDialog;{delph.forumalgerie.net}
    StatusBar1: TStatusBar;{delph.forumalgerie.net}
    Tools1: TMenuItem;{delph.forumalgerie.net}
    Fonts1: TMenuItem;{delph.forumalgerie.net}
    FontDialog1: TFontDialog;{delph.forumalgerie.net}
    ColorDialog1: TColorDialog;{delph.forumalgerie.net}
    Color1: TMenuItem;{delph.forumalgerie.net}
    N3: TMenuItem;{delph.forumalgerie.net}
    Left1: TMenuItem;{delph.forumalgerie.net}
    Right1: TMenuItem;{delph.forumalgerie.net}
    Center1: TMenuItem;{delph.forumalgerie.net}
    N4: TMenuItem;{delph.forumalgerie.net}
    DateTime1: TMenuItem;{delph.forumalgerie.net}
    procedure new1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure open1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure save1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure saveas1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure exit1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure cut1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure copy1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure past1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure select1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure clear1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure Fonts1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure Color1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure FormCreate(Sender: TObject);{delph.forumalgerie.net}
    procedure FormClose(Sender: TObject;{delph.forumalgerie.net} var Action: TCloseAction);{delph.forumalgerie.net}
    procedure FormCloseQuery(Sender: TObject;{delph.forumalgerie.net} var CanClose: Boolean);{delph.forumalgerie.net}
    procedure FormCloseMemos(Sender: TObject;{delph.forumalgerie.net} var int11: Integer);{delph.forumalgerie.net}
    procedure Left1Click(Sender: TObject);{delph.forumalgerie.net}
    procedure DateTime1Click(Sender: TObject);{delph.forumalgerie.net}
  private
    { Déclarations privées }
    PathName1: string;{delph.forumalgerie.net}
  public
    { Déclarations publiques }
    procedure Opene1(const BFileName: string);{delph.forumalgerie.net}
  end;{delph.forumalgerie.net}
const
  DefaultFileName1 = 'saad';{delph.forumalgerie.net}
var
  Form1: TForm1;{delph.forumalgerie.net}

implementation

{$R *.DFM}

procedure TForm1.new1Click(Sender: TObject);{delph.forumalgerie.net}
var
  intc: integer;{delph.forumalgerie.net}
begin
 FormCloseMemos(Sender,intc);{delph.forumalgerie.net}
 Memo1.Clear;{delph.forumalgerie.net}
 Memo1.Modified := false;{delph.forumalgerie.net}
 PathName1 := DefaultFileName1;{delph.forumalgerie.net}
 Caption := PathName1;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.open1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 OpenDialog1.Title := 'فتح';{delph.forumalgerie.net}
 if OpenDialog1.Execute then
  Opene1(OpenDialog1.FileName);{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.Opene1(const BFileName: string);{delph.forumalgerie.net}
begin
  PathName1 := BFileName;{delph.forumalgerie.net}
  Caption := ExtractFileName(PathName1);{delph.forumalgerie.net}
  Memo1.Lines.LoadFromFile(PathName1);{delph.forumalgerie.net}
  Memo1.SelStart := 0;{delph.forumalgerie.net}
  Memo1.Modified := false;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.save1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 if PathName1 = DefaultFileName1 then
  saveas1Click(Sender)
 else
 begin
  Memo1.Lines.SaveToFile(PathName1);{delph.forumalgerie.net}
  Memo1.Modified := false;{delph.forumalgerie.net}
 end;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.saveas1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 SaveDialog1.Title := 'حفـــظ بإســم';{delph.forumalgerie.net}
 SaveDialog1.FileName := PathName1;{delph.forumalgerie.net}
 if SaveDialog1.Execute then
 begin
  PathName1 := SaveDialog1.FileName;{delph.forumalgerie.net}
  Caption := ExtractFileName(PathName1);{delph.forumalgerie.net}
  save1Click(Sender);{delph.forumalgerie.net}
 end;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.exit1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 close;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.cut1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 Memo1.CutToClipboard;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.copy1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 Memo1.CopyToClipboard;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.past1Click(Sender: TObject);{delph.forumalgerie.net}
begin
  Memo1.PasteFromClipboard;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.select1Click(Sender: TObject);{delph.forumalgerie.net}
begin
  Memo1.SelectAll;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.clear1Click(Sender: TObject);{delph.forumalgerie.net}
begin
  Memo1.ClearSelection;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.Fonts1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 FontDialog1.Font := Memo1.Font;{delph.forumalgerie.net}
 FontDialog1.Font.Color := Memo1.Font.Color;{delph.forumalgerie.net}
 if FontDialog1.Execute then
 begin
  Memo1.Font := FontDialog1.Font;{delph.forumalgerie.net}
  Memo1.Font.Color := FontDialog1.Font.Color;{delph.forumalgerie.net}
 end;{delph.forumalgerie.net} //SelAttributes
end;{delph.forumalgerie.net}

procedure TForm1.Color1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 if ColorDialog1.Execute then
  Memo1.Color := ColorDialog1.Color;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.FormCreate(Sender: TObject);{delph.forumalgerie.net}
begin
  PathName1 := DefaultFileName1;{delph.forumalgerie.net}
  Windows.LoadKeyboardLayout('00000401', klf_Activate);{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.FormClose(Sender: TObject;{delph.forumalgerie.net} var Action: TCloseAction);{delph.forumalgerie.net}
begin
 Action := CaFree;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.FormCloseMemos(Sender: TObject;{delph.forumalgerie.net} var int11: Integer);{delph.forumalgerie.net}
const
    tWarningText = 'هل تريــــد حفــظ التغييــرات على هـذا الملـف %s?';{delph.forumalgerie.net}
var
  inta: integer;{delph.forumalgerie.net}
begin
  if Memo1.Modified then
  begin
    inta := MessageDlg(Format(tWarningText, [PathName1]), mtConfirmation,
    [mbYes, mbNo, mbCancel], 0);{delph.forumalgerie.net}
    if inta = idYes then Save1Click(Sender);{delph.forumalgerie.net}
  end;{delph.forumalgerie.net}
  int11 := inta;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.FormCloseQuery(Sender: TObject;{delph.forumalgerie.net} var CanClose: Boolean);{delph.forumalgerie.net}
var
  intb: integer;{delph.forumalgerie.net}
begin
  FormCloseMemos(Sender, intb);{delph.forumalgerie.net}
  if intb = idCancel then CanClose := false;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.Left1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 Left1.Checked := false;{delph.forumalgerie.net}
 Right1.Checked := false;{delph.forumalgerie.net}
 Center1.Checked := false;{delph.forumalgerie.net}
 with Sender as TMenuItem do Checked := true;{delph.forumalgerie.net}
 with Memo1 do
  if Left1.Checked then Alignment := taLeftJustify
 else if Right1.Checked then Alignment := taRightJustify
 else if Center1.Checked then
  Alignment := taCenter;{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

procedure TForm1.DateTime1Click(Sender: TObject);{delph.forumalgerie.net}
begin
 Memo1.Lines.Add(DateToStr(Date)+' , '+TimeToStr(Time));{delph.forumalgerie.net}
end;{delph.forumalgerie.net}

end.

_________________
[ندعوك للتسجيل في المنتدى أو التعريف بنفسك لمعاينة هذا الرابط]

ali1
مبرمج مجتهد

عدد المساهمات : 860
تاريخ التسجيل : 29/07/2013

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

رد: كيفية برمجة محرر بسيط بدلفي

مُساهمة  ali1 في 5/3/2016, 9:17 pm


الكود:

object Form1: TForm1
 Left = 192
 Top = 107
 Width = 696
 Height = 480
 BiDiMode = bdRightToLeft
 Color = clBtnFace
 Font.Charset = ARABIC_CHARSET
 Font.Color = clWindowText
 Font.Height = -11
 Font.Name = 'MS Sans Serif'
 Font.Style = [fsBold]
 Icon.Data = {
   0000010001002020040000000000E80200001600000028000000200000004000
   0000010004000000000000020000000000000000000000000000000000000000
   000000008000008000000080800080000000800080008080000080808000C0C0
   C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
   000000000000000000000000000000078888888888888888888880800000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   F000000FFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   F000000FFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FF000000000000000000FF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FF000000000000000000FF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FF000000000000000000FF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FF000000000000000000FF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   F000000FFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   F000000FFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   F000000FFFFFFF0F000FF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   FFFFFFFFFFFFFFFFFFFFF8080000007FFFFFFFFFFFFFFFFFFFFFF8080000007F
   0FF0FF0FF0FF0FF0FF0FF7080000007F0FF0FF0FF0FF0FF0FF0FF70800000007
   F77F77F77F77F77F77F77F70000000000000000000000000000000000000F000
   001FE000000FC0000007C0000007C0000007C0000007C0000007C0000007C000
   0007C0000007C0000007C0000007C0000007C0000007C0000007C0000007C000
   0007C0000007C0000007C0000007C0000007C0000007C0000007C0000007C000
   0007C0000007C0000007C0000007C0000007C0000007E000000FF24924BF}
 Menu = MainMenu1
 OldCreateOrder = False
 ParentBiDiMode = False
 Position = poDesktopCenter
 OnClose = FormClose
 OnCloseQuery = FormCloseQuery
 OnCreate = FormCreate
 PixelsPerInch = 96
 TextHeight = 13
 object Memo1: TMemo
   Left = 0
   Top = 0
   Width = 688
   Height = 407
   Align = alClient
   ScrollBars = ssBoth
   TabOrder = 0
 end
 object StatusBar1: TStatusBar
   Left = 0
   Top = 407
   Width = 688
   Height = 19
   Panels = <>
   SimplePanel = False
 end
 object MainMenu1: TMainMenu
   Left = 128
   Top = 96
   object file1: TMenuItem
     Caption = '&'#1605#1604#1601
     object new1: TMenuItem
       Caption = '&'#1580#1583#1610#1583
       ShortCut = 16462
       OnClick = new1Click
     end
     object open1: TMenuItem
       Caption = '&'#1601#1578#1581
       ShortCut = 16463
       OnClick = open1Click
     end
     object save1: TMenuItem
       Caption = '&'#1581#1601#1592
       ShortCut = 16467
       OnClick = save1Click
     end
     object saveas1: TMenuItem
       Caption = '&'#1581#1601#1592' '#1576#1575#1587#1605
       OnClick = saveas1Click
     end
     object N1: TMenuItem
       Caption = '-'
     end
     object exit1: TMenuItem
       Caption = #1582#1585#1608#1580
       ShortCut = 16499
       OnClick = exit1Click
     end
   end
   object edit1: TMenuItem
     Caption = #1578#1581#1585#1610#1585
     object cut1: TMenuItem
       Caption = '&'#1602#1589
       ShortCut = 16472
       OnClick = cut1Click
     end
     object copy1: TMenuItem
       Caption = '&'#1606#1587#1582
       ShortCut = 16451
       OnClick = copy1Click
     end
     object past1: TMenuItem
       Caption = '&'#1604#1589#1602
       ShortCut = 16470
       OnClick = past1Click
     end
     object N2: TMenuItem
       Caption = '-'
     end
     object select1: TMenuItem
       Caption = #1578#1581#1583#1610#1583
       ShortCut = 16449
       OnClick = select1Click
     end
     object clear1: TMenuItem
       Caption = #1605#1587#1581
       OnClick = clear1Click
     end
     object N4: TMenuItem
       Caption = '-'
     end
     object DateTime1: TMenuItem
       Caption = #1578#1575#1585#1610#1582' '#1608#1575#1604#1608#1602#1578
       OnClick = DateTime1Click
     end
   end
   object Tools1: TMenuItem
     Caption = '&'#1575#1593#1600#1600#1600#1583#1575#1583
     object Fonts1: TMenuItem
       Caption = '&'#1582#1600#1600#1600#1591
       OnClick = Fonts1Click
     end
     object Color1: TMenuItem
       Caption = '&'#1604#1600#1600#1600#1608#1606
       OnClick = Color1Click
     end
     object N3: TMenuItem
       Caption = '-'
     end
     object Left1: TMenuItem
       Caption = 'Right'
       OnClick = Left1Click
     end
     object Right1: TMenuItem
       Caption = 'Left'
       OnClick = Left1Click
     end
     object Center1: TMenuItem
       Caption = 'Center'
       OnClick = Left1Click
     end
   end
   object help1: TMenuItem
     Caption = #1605#1587#1575#1593#1583#1577
   end
 end
 object OpenDialog1: TOpenDialog
   DefaultExt = 'txt'
   Filter = 'fichier texte|*.txt|tout les fichiers|*.*'
   InitialDir = '.'
   Left = 192
 end
 object SaveDialog1: TSaveDialog
   DefaultExt = 'txt'
   Filter = 'fichier texte|*.txt|tout les fichiers|*.*'
   InitialDir = '.'
   Left = 224
 end
 object FontDialog1: TFontDialog
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   MinFontSize = 0
   MaxFontSize = 0
   Left = 256
 end
 object ColorDialog1: TColorDialog
   Ctl3D = True
   Left = 288
 end
end

_________________
[ندعوك للتسجيل في المنتدى أو التعريف بنفسك لمعاينة هذا الرابط]

ali1
مبرمج مجتهد

عدد المساهمات : 860
تاريخ التسجيل : 29/07/2013

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

رد: كيفية برمجة محرر بسيط بدلفي

مُساهمة  عبقادر بن فاطنة في 25/3/2016, 10:57 pm

بارك الله فيك

عبقادر بن فاطنة

عدد المساهمات : 3
تاريخ التسجيل : 03/01/2016

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

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


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