想做个简单的Delphi记事本小程序,请高手们帮帮忙教教我,给我一个完整的程序,最好要做的步骤。

请愿意帮忙者发至我邮箱:zjing626@163.com。非常感谢!... 请愿意帮忙者发至我邮箱:zjing626@163.com。非常感谢! 展开
 我来答
fff460284031
2010-04-25
知道答主
回答量:57
采纳率:0%
帮助的人:15.9万
展开全部
先做界面,总共三个窗体,再编写代码;
代码如下:
unit Unit1;

interface

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

type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
N20: TMenuItem;
N21: TMenuItem;
N23: TMenuItem;
N24: TMenuItem;
N25: TMenuItem;
N26: TMenuItem;
N27: TMenuItem;
N28: TMenuItem;
N29: TMenuItem;
N30: TMenuItem;
N31: TMenuItem;
N32: TMenuItem;
N33: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
FontDialog1: TFontDialog;
PrintDialog1: TPrintDialog;
FindDialog1: TFindDialog;
PageSetupDialog1: TPageSetupDialog;
ReplaceDialog1: TReplaceDialog;
PrinterSetupDialog1: TPrinterSetupDialog;
PageSetupDialog2: TPageSetupDialog;
StatusBar1: TStatusBar;
richedit1: TRichEdit;
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure N27Click(Sender: TObject);
procedure N28Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N30Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N24Click(Sender: TObject);
procedure N25Click(Sender: TObject);
procedure N32Click(Sender: TObject);
procedure N33Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure N20Click(Sender: TObject);
private
\{ Private declarations \}
public
\{ Public declarations \}
end;

var
Form1: TForm1;

implementation

uses Unit2, Unit3;

\{$R *.dfm\}

procedure TForm1.N2Click(Sender: TObject);
begin
form1.RichEdit1.Lines.Clear;
end;

procedure TForm1.N3Click(Sender: TObject);
begin
form1.OpenDialog1.Execute;
form1.richedit1.Lines.LoadFromFile(form1.OpenDialog1.FileName);
end;

procedure TForm1.N4Click(Sender: TObject);
begin
form1.SaveDialog1.Execute;
form1.richedit1.Lines.SaveToFile(form1.SaveDialog1.FileName);
end;

procedure TForm1.N19Click(Sender: TObject);
begin
finddialog1.Execute;
end;

procedure TForm1.FindDialog1Find(Sender: TObject);
var
a:longint;
s,t:integer;
begin
with richedit1 do
begin
if richedit1.SelLength<>0 then
s:=richedit1.SelStart+richedit1.SelLength
else
s:=0;
t:=Length(richedit1.Text)-s;
a:=findtext(finddialog1.FindText,s,t,[stmatchcase]);
end;
if a<>-1 then
begin
richedit1.SetFocus;
richedit1.SelStart:=a;
richedit1.SelLength:=length(finddialog1.FindText);
end;
end;
procedure TForm1.N10Click(Sender: TObject);
begin
close;
end;

procedure TForm1.N15Click(Sender: TObject);
begin
if richedit1.SelLength>0 then
begin
richedit1.CopyToClipboard;
N15.Enabled:=true;
end
else
showmessage('\'c7\'eb\'cf\'c8\'d1\'a1\'b6\'a8\'d2\'aa\'b8\'b4\'d6\'c6\'b5\'c4\'c4\'da\'c8\'dd');

end;

procedure TForm1.N14Click(Sender: TObject);
begin
form1.richedit1.CutToClipboard;
end;

procedure TForm1.N16Click(Sender: TObject);
begin
richedit1.SetFocus;
form1.Richedit1.PasteFromClipboard;
end;

procedure TForm1.N17Click(Sender: TObject);
begin
form1.richedit1.ClearSelection;
end;

procedure TForm1.N27Click(Sender: TObject);
begin
if n27.Checked=false then
begin
n27.Checked:=true;
richedit1.WordWrap:=true;
end
else
begin
n27.Checked:=false;
richedit1.WordWrap:=false;
end;
end;

procedure TForm1.N28Click(Sender: TObject);
begin
if FontDialog1.Execute then
begin
richedit1.Font:= FontDialog1.Font;
end;

end;

procedure TForm1.N7Click(Sender: TObject);
begin
pagesetupdialog1.execute;
end;

procedure TForm1.N8Click(Sender: TObject);
begin
printersetupdialog1.execute;
end;

procedure TForm1.N30Click(Sender: TObject);
begin
if n30.Checked=false then
begin
n30.Checked:=true;
statusbar1.Visible:=true;
statusbar1.SimpleText:= datetostr(Date)+' '+timetostr(time);
end
else
begin
n30.Checked:=false;
statusbar1.Visible:=false;
end;
end;

procedure TForm1.N12Click(Sender: TObject);
begin
richedit1.Undo;
end;

procedure TForm1.N24Click(Sender: TObject);
begin
richedit1.SelectAll;
end;

procedure TForm1.N25Click(Sender: TObject);
begin
richedit1.Text:=richedit1.Text+datetostr(Date)+' '+timetostr(time);
end;

procedure TForm1.N32Click(Sender: TObject);
begin
form2.show;
end;

procedure TForm1.N33Click(Sender: TObject);
begin
form3.show;
end;

procedure TForm1.N5Click(Sender: TObject);
begin
savedialog1.Filter:='text files(*.txt)|*.txt|all file(*.*)|*.*';
if savedialog1.Execute=true then
richedit1.Lines.SaveToFile(savedialog1.FileName);
end;

procedure TForm1.N21Click(Sender: TObject);
begin
ReplaceDialog1.Execute;
end;

procedure TForm1.N20Click(Sender: TObject);
var
a:longint;
s,t:integer;
begin
with richedit1 do
begin
if richedit1.SelLength<>0 then
s:=richedit1.SelStart+richedit1.SelLength
else
s:=0;
t:=Length(richedit1.Text)-s;
a:=findtext(finddialog1.FindText,s,t,[stmatchcase]);
end;
if a<>-1 then
begin
richedit1.SetFocus;
richedit1.SelStart:=a;
richedit1.SelLength:=length(finddialog1.FindText);
end;
end;
end.
做好后,再设置相关的属性就行。
曾哥那才是爷们
2010-04-25
知道答主
回答量:40
采纳率:0%
帮助的人:18.1万
展开全部
自己做个界面出来,然后在添加菜单,给不同的名字写代码,就这,很简单的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式