码迷,mamicode.com
首页 > Windows程序 > 详细

delphi 10.2 ----memo 的例子 实现基本记事本功能

时间:2018-10-16 16:06:25      阅读:412      评论:0      收藏:0      [点我收藏+]

标签:exe   image   imp   inf   .text   edit   sys   win   controls   

技术分享图片

 

 

unit Unit2;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TForm2 = class(TForm)
Memo1: TMemo;
SaveDialog1: TSaveDialog;
OpenDialog1: TOpenDialog;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Memo2: TMemo;
Label1: TLabel;
Label2: TLabel;
procedure Edit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
memo2.Lines.Add(memo1.Lines.Text) ;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
if memo2.SelLength>0 then
memo2.CutToClipboard;


end;

procedure TForm2.Button3Click(Sender: TObject);
begin
if memo2.SelLength >0 then
memo2.CopyToClipboard;
end;

procedure TForm2.Button4Click(Sender: TObject);
begin
if memo2.SelLength = 0 then
memo2.PasteFromClipboard;

end;

procedure TForm2.Button5Click(Sender: TObject);
begin
if savedialog1.Execute then
memo2.Lines.SaveToFile(savedialog1.FileName);

end;

procedure TForm2.Button6Click(Sender: TObject);
begin
if opendialog1.Execute then
memo2.Lines.LoadFromFile(opendialog1.FileName);
end;

procedure TForm2.Edit1Change(Sender: TObject);
begin
memo1.Lines[0]:=‘aaaaa‘;
end;

delphi 10.2 ----memo 的例子 实现基本记事本功能

标签:exe   image   imp   inf   .text   edit   sys   win   controls   

原文地址:https://www.cnblogs.com/baili-luoyun/p/9797872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!