求人在delphi7中写一个hello,world!, 要求用ide那种写的那种,不是命令写的,要点击一下按键然后显示出来,小弟刚学delhi,调了半天,没有出来。最好还能推荐下新手用的书。小弟谢谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 真是有意思的问题了:=赋值就好了或者ShowMessage 工程文件(扩展名为.dpr):program Project1;uses Forms, Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run;end.单元文件(扩展名为.pas):unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);begin ShowMessage('Hello,world!');end;end.DFM文件(扩展名为.DFM):object Form1: TForm1 Left = 192 Top = 140 Width = 1305 Height = 675 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Button1: TButton Left = 200 Top = 176 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 0 OnClick = Button1Click endend可以将上述内容复制到记事本中,分别以 Project1.dpr , Unit1.pas , Unit1.dfm 保存,然后,用Delphi7打开Project1.dpr ,按F9运行即可看到执行的结果。推荐你看《Delphi5开发人员指南》,比较经典的一本书。 本帖最后由 tjianliang 于 2010-04-28 12:43:26 编辑 ok,问题解决拉!原来是没有弄那个DFM文件:还有那个按钮不是拖上去的,是双击上面的。弄了半天!太小白了!谢谢了!还有我怎么找不到那个.dpr文件. 创建窗体动态链接库,成功运行,在文件夹里找不到后缀是.dll的对象 用idftp如何从ftp服务器里的一个子目录里下载一个文件? 通用问题:点修改,和增加按钮能不能调用同一个窗体? 为什么我的程序在英文操作系统是录入中文就会出现乱码呢,而且不能保存到数据库中? 恳求源代码? 我发现一个 CSDN 的 Bug,我的得分究竟是多少? 请指教,高手请帮忙 在数据库中新增记录的问题,急,请大家帮忙!!!!QQ:16262688. Delphi 中怎样写汇编过程之间的调用?请付例子,急,加分!! 如何使用QuickRep制作简单报表?不牵涉任何DataSet的 按键精灵得插件都是用什么语言做的 问个基础问题,在DELPHI 2010中CHAR和PCHAR数据类型有什么区别
Forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.单元文件(扩展名为.pas):unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Hello,world!');
end;end.DFM文件(扩展名为.DFM):object Form1: TForm1
Left = 192
Top = 140
Width = 1305
Height = 675
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 200
Top = 176
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
end
可以将上述内容复制到记事本中,分别以 Project1.dpr , Unit1.pas , Unit1.dfm 保存,然后,用Delphi7打开Project1.dpr ,按F9运行即可看到执行的结果。
推荐你看《Delphi5开发人员指南》,比较经典的一本书。