12 2011 档案
摘要:以下列出了《Pascal精要》中用到的所有例子,需要可以从网上免费下载:第三章ResStr: 资源串 Range: 有序类型取值范围 TimeNow: 时间类型数据操作第四章GPF: 空指针的一般保护错第五章IfTest: if 语句 Loops: for 和 while 语句第六章OpenArr: 开放数组参数 DoubleH: 几个简单的过程 ProcType: 过程类型 OverDef: 重载及缺省参数第七章StrRef: 字符串引用计数 LongStr: 使用长字符串 FmtTest: 格式化举例第八章DynArr: 动态数组 WHandle: Windows 句柄 Callback:
阅读全文
摘要:Delphi 应用程序中的单元,或说程序模块可谓老道精深。实际上,单元是程序模块化的基础,类是继它之后才有的。在Delphi 应用程序中,每个窗体都有一个相对应的单元。用相应的工具按钮, 或File > New Form 菜单命令,在工程中添加一个新窗体,实际上是增加了一个新单元,也就是建立了该新窗体的类。单元 虽然所有窗体都在单元中定义,但反之则不然。除窗体外,单元中还可以定义一系列能访问的例程。选择File > New菜单命令,然后在Object Repository的New 页中选择Unit 图标,随即当前工程中就会加入一个空白单元。单元代码分区存放,空白单元的代码如下:un
阅读全文
摘要:这里列出了本书中用到的一些技术术语,在别的地方你也能找到它们,不过我想还是把它们集中一处,以便查找。堆(内存) 堆表示程序可用的内存区,也叫动态内存区。堆内存的分配与释放次序是随机的,这就是说,如果你按次序分配三块内存,那么到时并不按分配时的次序释放内存。 堆管理器会负责所有操作,你只需简单地使用GetMem 函数请求新内存或调用constructor 建立对象, Delphi 会返回一个新的内存块(随意重用已经丢弃的内存块)。 堆是应用程序可用的三种内存区之一, 其它两种分别是全局内存区(存放全程变量) 和栈。与堆相反,全程变量内存在程序启动时就分配,然后一直保留到程序终止才释放;栈...
阅读全文
摘要:为了完全支持OLE,32位Delphi 增加了Variant 数据类型,本节将从宏观角度来分析这种数据类型。实际上,Variant类型对Pascal语言有普遍而深入的影响,Delphi 控件库中与OLE 无关的地方也使用到这种类型。Variant变量没有类型 一般说来,你可以用Variant 变量存储任何数据类型,对它执行各种操作和类型转换。需要注意的是:这违反了Pascal 语言的一贯原则,有悖于良好的编程习惯。variant 变量的类型检查和计算在运行期间才进行,编译器不会提示代码中的潜在错误,这些错误在进一步测试中才能发现。总之,你可以认为包含variant变量的代码是解释性代码,...
阅读全文
摘要:Delphi 利用Object Pascal 和可视控件库(VCL)对底层的Windows API 进行了完美的封装,所以很少需要使用基础Pascal 语言来建立Windows应用程序,也无需直接调用Windows API 函数。尽管如此,如果遇到特殊情况,VCL 又不支持,Delphi程序员还得直接面对Windows编程。不过只有在极其特殊的情况下,例如:基于不寻常API 调用的Delphi新控件开发, 你才需要这样做,这里我不想讨论这方面内容,我只想让大家看一下与操作系统交互的几个Delphi元素以及Delphi程序员能从中获益的Windows编程技术。Windows 句柄 Delp...
阅读全文
摘要:作者的话:本章内容涉及内存处理,讨论各种内存区,并介绍动态数组。目前暂时只有动态数组部分。Delphi 4 的动态数组 传统的Pascal 语言其数组大小是预先确定的,当你用数组结构声明数据类型时,你必须指定数组元素的个数。专业程序员也许知道些许动态数组的实现技术,一般是采用指针,用手工分配并释放所需的内存。 Delphi 4中增加了非常简单的动态数组实现方法,实现过程效仿我前面讲过的动态长字符串。与长字符串一样,动态数组的内存动态分配并且引用记数,不过动态数组不支持 copy-on-write 技术。这不是个大问题,因为你可以把变量值设置为nil释放数组内存。 这样你就可以声明一个不指...
阅读全文
摘要:Delphi 中字符串的操作很简单,但幕后情况却相当复杂。Pascal 传统的字符串操作方法与Windows 不同,Windows吸取了C语言的字符串操作方法。32位Delphi中增加了长字符串类型,该类型功能强大,是Delphi 确省的字符串类型。字符串类型 在Borland公司的Turbo Pascal和16位Delphi中,传统的字符串类型是一个字符序列,序列的头部是一个长度字节,指示当前字符串的长度。由于只用一个字节来表示字符串的长度,所以字符串不能超过255个字符。这一长度限制为字符串操作带来不便,因为每个字符串必须定长(确省最大值为255),当然你也可以声明更短的字符串以节约...
阅读全文
摘要:例程(routine)是Pascal 的一个重要概念,例程由一系列语句组成,例程名是唯一的,通过例程名你可以多次调用它,这样程序中只需要一个例程就够了,由此避免了代码多次重复,而且代码也容易修改维护。从这个角度看,你可以认为例程是一种基本的代码封装机制。介绍完Pascal 例程的语法后,我会回过头来举例说明这个问题。Pascal 过程与函数 Pascal中的例程有两种形式:过程和函数。理论上说,过程是你要求计算机执行的操作,函数是能返回值的计算。两者突出的不同点在于:函数能返回计算结果,即有一个返回值,而过程没有。两种类型的例程都可以带多个给定类型的参数。 不过实际上函数和过程差别不大...
阅读全文
摘要:如果说数据类型是Pascal 编程的一个基础,那么另一个则是语句。编程语言的语句主要由关键字和操作指令组成。语句常放在过程或函数中,就象我们将在下一章中看到的那样。现在,我们集中讲解最基本的编程语句。简单语句和复合语句 Pascal 简单语句中不包含任何别的语句,赋值语句和过程调用即是简单语句的例子。简单语句用分号隔开,如下所示:X := Y + Z; // assignmentRandomize; // procedure call 用begin 和end 将简单语句括起来即组成复合语句,复合语句用法与普通的Pascal 语句相同,见下例:begin A := B; C :...
阅读全文
摘要:Pascal 语言的一个重要特征是它能自定义数据类型。通过各种类型构造器,你可以定义自己的数据类型,如子界类型、数组类型、记录类型、枚举类型、指针类型和集合类型。最重要的用户定义数据类型是类(class),类是Object Pascal的面向对象扩展部分,本书不讨论这部分。 你可能会认为其它编程语言也有诸如此类的类型构造器,确实如此,但是Pascal 是第一个完美实现这一理论的语言。至今仍然没有语言有能力定义那么多的数据类型。命名及不命名的类型 为了后续使用或直接用于变量,需要给自定义类型命名。如果自定义一个命名的类型,你必须将代码放在特定的type区,如下所示:type // su...
阅读全文
摘要:最初的Pascal 语言是以一些简单的概念为基础建立起来的,这些概念现在普遍出现在编程语言中。最重要的概念当属数据类型,数据类型决定了变量可取的值,以及可在这些值上进行的操作。Pascal 数据类型的概念强于C语言及早期的BASIC语言,在C语言中算术数据类型是可以互换的,而早期的BASIC语言中根本没有与数据类型相似的概念。变量 Pascal 变量在使用前必须声明,声明变量时必须指定一种数据类型。下面是变量声明的例子:var Value: Integer; IsCorrect: Boolean; A, B: Char; 关键字var可以在许多地方使用,例如放在函数或过程的开始部...
阅读全文
摘要:进入正题前先谈一下Pascal代码编写风格的问题。“除了遵循语法规则外,你应该怎样来写代码呢?” 关于这个问题各人答案会有不同,因为各人喜欢的风格不同。总的来说,任何编码风格的目标都是使代码清楚、明晰,采用某种风格和格式只是一种简略方法,用于更清楚地表达你的代码要干什么。实现代码清楚明晰的基本原则是保持代码的一致性,也就是无论选用哪种风格,在整个工程中要始终保持同一风格。注释 在Pascal中,注释括在大括号中或带星号的圆括号中。Delphi 也认可C++ 风格的注释,即把注释放在双斜线后。例如{this is a comment}(* this is another comment *...
阅读全文
摘要:Delphi中使用的面向对象pascal编程语言并不是borland公司1995年发布可视化开发环境Delphi时才有的,它只是已有borland pascal产品的简单扩展。 Borland没有发明pascal,但它推广并扩展了pascal。这一章对pascal语言的历史背景及其发展历程作一简短回顾。沃斯的pascal Pascal 语言最初由瑞士苏黎士理工学院的尼古拉斯-沃斯(Niklaus Wirth)教授在1971年设计, 作为Algol语言(1960年设计)简化本用于教学目的。 设计Pascal时,许多编程语言业已存在,但只有FORTRAN、C、Assembler、COBOL...
阅读全文
摘要:library AngToArcDLL; //dll工程的工程名{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function
阅读全文
摘要:library AngToArcDLL; //dll工程的工程名{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Label1: TLabel; Timer1: TTimer; Timer2: TTimer; procedure FormPaint(Sender: TObject); procedure Timer1Timer(Sender: TObject); ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, MPlayer;type TForm1 = class(TForm) MediaPlayer1: TMediaPlayer; Panel1: TPanel; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton;...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Animate1: TAnimate; Animate2: TAnimate; procedure FormCreate(Sender: T...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, mmsystem;type TForm1 = class(TForm) procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, ExtCtrls;type TForm1 = class(TForm) PaintBox1: TPaintBox; MainMenu1: TMainMenu; N1: TMenuItem; N2: TMenuItem; sin1: TMenuItem; cos1: TMenuItem; cls1: TMenuItem;...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}p...
阅读全文
摘要: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...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls;type TForm1 = class(TForm) Shape1: TShape; Shape2: TShape; procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); privat...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls;type TForm1 = class(TForm) Image1: TImage; procedure FormCreate(Sender: TObject); procedure FormResize(Sender: TObject); private { Private declarations } public {...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtDlgs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Image1: TImage; OpenPictureDialog1: TOpenPictureDialog; procedure Button1Click(Sender: TObject); priva...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) GroupBox1: TGroupBox; GroupBox2: TGroupBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Edit...
阅读全文
摘要:翻译的不好,请见谅。 翻译:鲁小班文件: ActnList CreateAction 函数 创建一个指定类型的Action,显示在action list editor中。 EnumRegisteredAction 过程 枚举已经注册的Action RegisterAction 过程 注册Action UnRegisterAction 过程 反注册Action文件: Classes Bounds 函数 输入上下高宽返回一个矩形结构。 CollectionsEqual 函数 比较两个TCollection是不是相等。 CurrentGroup 变量 FindClass 函数 从输入字符串中返回一个
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton;...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Edit1: TEdit; Memo1: TMemo; procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedu...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormMouseDown(Sender: TObject; Button: TMo...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; Timer1: TTimer; procedure Button1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject)...
阅读全文
摘要:虚拟键码对应值对应键VK_LBUTTON1鼠标左键VK_RBUTTON2鼠标右键VK_CANCEL3CancelVK_MBUTTON4鼠标中键VK_XBUTTON15VK_XBUTTON26VK_BACK8BackspaceVK_TAB9TabVK_CLEAR12ClearVK_RETURN13EnterVK_SHIFT16ShiftVK_CONTROL17CtrlVK_MENU18AltVK_PAUSE19PauseVK_CAPITAL20Caps LockVK_KANA21VK_HANGUL21VK_JUNJA23VK_FINAL24VK_HANJA25VK_KANJI25*VK_ESCA
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { P...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; p...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; ListBox1: TListBox; ListBox2: TL...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObj...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; ListBox1: TListBox; ListBox2: TListBox; ListBox3...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) ListBox1: TListBox; bt: TButton; Button2: TButton; procedure btClick(Sender: TObject); procedure Button2Click(Sender: TObject); private ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Button2: TButton; ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) GroupBox1: TGroupBox; Edit1: TEdit; Label1: TLabel; ComboBox1: TComboBox; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; procedure FormCreate(Sender: TObject); procedur...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Mask, Menus;type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Butt...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure FormShow(Sender: TObject)...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Button2: TButton; ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; procedure Butt...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private id: array [1.....
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; MainMenu1: TMainMenu; S1: TMenuItem; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMen...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; FontDialog1: TFontDialog; ColorDialog1: TColorDialog; Button1: TBu...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Label1: TLabel; Timer1: TTimer; RadioGroup1: TRadioGroup; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; ScrollBar1: TScrollBar; Button1: TButton; Button2: TButton; Edit1: TEdit; procedure Button1Click(Se...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) ComboBox1: TComboBox; ComboBox2: TComboBox; ComboBox3: TComboBox; ComboBox4: TComboBox; GroupBox1: TGroupBox; Label1: TLabel; Label...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) RadioGroup1: TRadioGroup; Label1: TLabel; procedure RadioGroup1Click(Sender: TObject); private { Private declarations } public ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) RadioButton1: TRadioButton; RadioButton2: TRadioButton; RadioButton3: TRadioButton; RadioButton4: TRadioButton; Label1: TLabel; proced...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) GroupBox1: TGroupBox; GroupBox2: TGroupBox; Memo1: TMemo; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckBox3: TCheckBox; ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Buttons, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Label1: TLabel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; SpeedButton4: TSpe...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Edit1: TEdit; Edit2: TEdit; Memo1: TMemo; MaskEdit1: TMaskEdit; MaskEdit2: TMaskEdit; ...
阅读全文
摘要:!去掉输入数据开头的空格符>让输入数据的字母都变成大写,直到遇上掩码字符<<让输入数据的字母都变成小写,直到遇上掩码字符><>不限制输入数据字母是大写或小写\若在输入格式内加入某个特殊字符,只要在特殊字符的前面加上此掩码就可以。L允许输入英文字母,而且一定要输入l允许输入英文字母,不一定要输入A允许输入英文字母和阿拉伯数字,一定要输入a允许输入英文字母和阿拉伯数字,不一定要输入C允许输入任何字符,一定要输入c允许输入任何字符,不一定要输入0允许输入阿拉伯数字,一定要输入9允许输入阿拉伯数字,不一定要输入#允许输入阿拉伯数字或正、负号字符:用来分隔时间数据中的
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Memo1: TMemo; procedure Button1Click(Sender: TObject); procedure FormActivate(Sender: TObject); private ...
阅读全文
摘要:备注框在Delphi 中用 Tmemo 类处理.Tmemo 类是 Tedit 类的衍生类,因此,Tedit 类所具有的属性、事件和方法在 Tmemo 类中都有.另外,为了处理多行文本,Tmemo 类还增加了一些新的属性。(1) CaretPos 属性:用来得到光标在编辑区中的位置.如 Memol. CaretPos.y 表示光标所在行数.(2) Lines 属性:按行处理文本.lines 属性实际上是一个Tstring 类型的对象.用来存放 Memo 对象的文本。Tstrings 类型有一个默认的属性 Strings,定义为:Property Strings[Index: integer]:
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Se...
阅读全文
摘要:Edit 组件以下介绍 Edit 的主要属性。(1) AutoSelect 属性:用于设置编辑框得到焦点时,文本是否自动被选中。(2) AutoSize 属性:决定编辑框是否自动随字体的变化而改变大小。(3) Enable 属性:用来设置编辑框是否能用。(4) BorderSytle 属性:用来设置编辑框的边框类型,取 bsSigle 为单线,取 bsNone 为 无框。(5) MaxLength 属性:用于设置所能接受的最大字符数。(6) PasswordChar 属性:该属性设置非 #0 字符时,将代替用户输入的字符被显示。(7) ReadOnly 属性: 决定编辑框中的文本是否可以编辑。
阅读全文
摘要:对话框是用户与应用程序交换信息的最佳途径之一。使用对话框函数或过程可以调用Delphi 的内部对话框,这种方法具有操作简单及快速的特点。Delphi 提供的内部对话框有如下两种。第一种:信息输出对话框。包括 ShowMessage 过程、ShowMessageFmt 过程、MessageDlg函数、MessageDlgPos 函数和 CreateMessageDialog 函数. 第二种:信息输入对话框. 包括 InputBox 函数和 InputQuery 函数.1. ShowMessage 过程ShowMessage(<信息内容>);说明:( 1) ShowMessage 过程
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); pr...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); pr...
阅读全文
摘要:1. TForm 的主要属性窗体组件( TForm)是一种特殊的组件,它在运行时表现为一个窗体,窗体是一个容器构件,它可以包含其他种类的构件,并协同完成应用程序的整体功能.窗体和其他组件一样由属性、事件和方法组成.1) BordcrIcons 属性BordcrIcons 属性用来制定窗体标题栏上的图标,可以设置为下列取值。• biSystemMenu: 可以通过单击标题栏左边的图标或在标题栏上单击右键来显示控制菜单. 控制菜单有时也称为系统菜单.• biMinimize: 在标题栏右边显示最小化按钮.• biMaximize: 在标题栏右边显示最大化按钮.• biHelp: 在标题栏右边显示帮
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; ...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; p...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Memo1: TMemo; Button1: TButton; Label3: TLabel; Label4: TLabel; Label5: TLabel; procedure Button...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObj...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Label3: TLabel; Edit2: TEdit; Label4: TLabel; Edit3: TEdit; Button1: TButton; p...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { P...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObj...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Button2: TButton; procedure Button2Click(Sender: TObjec...
阅读全文
摘要:保留字 andarrayasasmbegincaseclassconstconstructordestructordispinterfacedivdodonwntoelseendexceptexportsfilefinalizationfinallyforfunctiongotoifimplementationininheritedinitializationinlineinterfaceislabellibrarymodnilnotobjectoforoutpackedprocedureprogrampropertyraiserecordrepeatresourcestringse...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edi...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; procedure Button1Cli...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); pr...
阅读全文
摘要: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...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Button1: TButton; procedure Edit1Change(Sender: TObject); procedure But...
阅读全文
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); ...
阅读全文
摘要:unit Unit1; //单元文件名interface //接口关键字,用它来标识文件所调用的单元文件uses //使用的公共单元 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type //定义程序所使用的组件以及组件所对应的事件 TForm1 = class(TForm) priva...
阅读全文

浙公网安备 33010602011771号