jsj_DELPHI基本语法
更新时间:2023-07-20 09:15:02 阅读量: 实用文档 文档下载
- jsj的林成美推荐度:
- 相关推荐
delphi网络资源总结,话了重点,方便阅读,记忆
Delphi Pascal
Pascal (.EXE) Pascal Delphi Object Pascal Delphi Object Pascal Pascal Pascal Pascal Object Pascal Borland Pascal Checking)
Range Checking 10 Double 10.0 Double Delphi “ Type Compatibility and Assignment Compatibility”
2.1 Object Pascal
Pascal Object Pascal Object Pascal Pascal
delphi网络资源总结,话了重点,方便阅读,记忆
Delphi {} Delphi Borland Pascal 2.1.1 Object Inspector(Object
Inspector) Delphi Proprety” onClick Edit1 Color clRed:
procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Color := clRed; end; .” clRed :=” Color clRed
TColor bject Inspector F1 Color Property Color : TColor; (Read Only) Delphi
delphi网络资源总结,话了重点,方便阅读,记忆
2.1.2.3
const Pi = 3.14159; Answer = 342; ProductName = "Delphi"; real = "
2.1.3
Delphi (Method) procedure Delphi
2.1.3.1 Delphi Memo
Delphi Memo( ) CutToClipboard memo ?BR> Memo1 memo CutToClipboard
Memo1.CutToClipboard; Memo1 CutToClipboard Delphi Unknown
identifier CutToclipboard Memo1
delphi网络资源总结,话了重点,方便阅读,记忆
Delphi memo Name
Cut,Copy,Paste,Clear Name Caption
Caption &” memo ScrollBars ScVertical WordWrap True Memo Line Memo1 memo procedure TForm1.CutClick(Sender: TObject) begin Memo1.CutToClipboard; end; procedure TForm1.CopyClick(Sender: TObject); begin Memo1.CopyToClipboard; end; procedure TForm1.PasteClick(Sender: TObject); begin Memo1.PasteFromClipboard; end; procedure TForm1.ClearClick(Sender: TObject); begin Memo1.clear; end; Memo Topic Search Memo Component Method
2.1.2
Delphi (var) (const) (type) (procedure) (Method) Object
Pascal Object Pascal
delphi网络资源总结,话了重点,方便阅读,记忆
Object Pascal Delphi
2.1.2.1
var (:) var Value ,Sum : Integer; Line :
String; Edit1 ( Name) Add procedure
TForm1.addClick(Sender: TObject); var X , Y: Integer; begin X := 100; Y := 20; Edit1.Text := IntToStr(X + Y); end; 2.1.3.2 Delphi ADD 120 Object Pascal X 100.0 IntToStr Object Pascal
LoadFromFile TString Procedure LoadFromFile(const FileName:
String) FileName Open
2.1.2.2 Delphi Memo Object Pascal begin Integer -
32768 32767, 2 Shortint -
delphi网络资源总结,话了重点,方便阅读,记忆
128 127 1
OpenDialog.Execute; Longint -2147443648 2147483647 4 Byte 0 255 1 Word 0
Memo1.lines.LoadFromFile
(OpenDialog.FileName); 65535 2 end;
Single 7 8 4 Double 15 16 8 Extended 19 20 2.1.3.3 Delphi 10 Comp 19 20 8
8087/80287 [N+] Real 11 12 6 Borland Pascal Double Extended Boolean true False 1 Char ASCII String 255 ASCII Edit1.Text := Pointer
IntToStr(X + Y) IntToStr(Value) LongInt Value PChar IntToStr Delphi TColor
delphi网络资源总结,话了重点,方便阅读,记忆
True False Boolean ColorDialog Name ChangeColor onClick Shortint -128 127 Shortint 7 300 300 Shortint procedure
TForm1.ChangeColorClick(Sender: TObject); (
Options|Project Compiler Options Page Range begin
if ColorDialog1.Execute then Form1.Color := ColorDialog1.Color else
Form1.Color := clRed; end; Boolean Execute OK ColorDialog.Execute True
Form1.Color ColorDialog1.Color Cancel False
2.1.6
Object Pascal
delphi网络资源总结,话了重点,方便阅读,记忆
Delphi procedure TForm.Button1Click(Sender Tobject); var { }
Name : string; begin { } Name := Edit1.Text; Edit2.Text := 'Welcome to Delphi'+Name; end; { } interface
implementation end. Delphi
2.1.4
Object Pascal if case
2.1.4.1 if
if ColorDialog.Execute Boolean True if False =” True then else if else False if
delphi网络资源总结,话了重点,方便阅读,记忆
begin…end else else if begin…end ” else if
2.1.4.2 case
case (LongInt ) case if case procedure TForm1.Button1Click(Sender: TObject); var Number : Integer; begin Number := StrToInt(Edit1.Text); case Number of 1,3,5,7,9: Label2.Caption := ' '; 0,2,4,6,8:
Label2.Caption := ' '; 10..100: begin Label2.Caption := ' 10 100 '; Form1.Color := clBlue; end; else
Label2.Caption := ' 100 '; end; end; Edit1 OK” Number case Number if case else case end
2.1.7 2.1.7.1
2.1.7.2
delphi网络资源总结,话了重点,方便阅读,记忆
(.) Unit1 CalculateInterest Unit2 Unit2 uses Unit1 Unit1.CalculateInterest
(PrincipalInterestRate : Double)
2.1.7.3
implementation Count …implememntation var Count : Integer; procedure TForm1.AddClick(Sender:TObject); var FirstNumber,SecondNumber:Integer; begin Count := Count + 1; Counter.Text := IntToStr(Count); FirstNumber := StrToInt(Edit1.Text); SecondNumber := StrToInt(Edit2.Text); Edit3.Text := IntToStr
(FirstNumber+SecondNumber); end; … Count Count end. initialization Count … initialization
Count := 0; AddClick Count
delphi网络资源总结,话了重点,方便阅读,记忆
Count 2.1.8 Delphi
2.1.5
Object Pascal repeat while for
2.1.5.1 repeat
repeat repeat until i := 0; repeat i := i+1; Writen(i); until i=10; 1 10 i=10 ( “=” )
repeat..until repeat
2.1.5.2 while
while repeat while while repeat i := 0; while i<10 do begin i := i+1; writeln(i); end;
2.1.5.3 for
for 1 5 i
delphi网络资源总结,话了重点,方便阅读,记忆
var i : integer; for i := 1 to 5 do writeln(i); for for repeat..until while..do
2.1.8.1
function NoValue(AnEditBox:TEdit):Boolean; begin if AnEditBox.Text='' then begin AnEditBox.Color := clRed; AnEditBox.Text := ' '; Result := True; end else begin AnEditBox.Color := clWindow; Result := False; end; end; NoValue Result Delphi NoValue procedure TForm1.AddClick(Sender: TObject); var FirstNumber,SecondNumber : Integer; begin if NoValue(Edit1)or NoValue(Edit2) then exit; Count := Count + 1; Counter.Text := IntToStr(Count); FirstNumber := StrToInt(Edit1.Text); SecondNumber := StrToInt(Edit2.Text); Edit3.Text := IntToStr
(FirstNumber+SecondNumber); end; exit
if A>0 rhen test1(A); { Test2 Test1} end; procedure
delphi网络资源总结,话了重点,方便阅读,记忆
TForm1.Button1Click(Sender:TObject); begin Alpha := 15; { Alpha } Test1(Alpha); { Test1, } end;
onClick Alpha 1 2 Alpha 0
2.1.8.6
NoValue AnEditBox if NoValue(Edit1)… Edit1 procedure Calculate
(CalNo:Integer); begin CalNo := CalNo*10; end; Calculate … Number := StrToInt(Edit1.Text); Calculate(Number); Edit2.Text := IntToStr(Number); … Number 1 Calculate Calculate Number CalNo CalNo Number 2 1 var procedure Calculate(var CalNo :
Integer); CalNo Number
delphi网络资源总结,话了重点,方便阅读,记忆
CalNo var CalNo Number Nnmber 10 const
2.1.8.2
procedure function procedure validateDate(Day : Integer; month :
Integer; Year : Integer); procedure ValidateDate(Day, Month, Year : Integer); Double function
CalculateInterest(principal,InterestRate:Double):Double;
2.1.8.3
Object Pascal Delphi type type Tcount = Integer; TPrimaryColor = (Red,Yellow,Blue); TTestIndex = 1..100; TTextValue = -99..99; TTestList = array [TTestIndex] of TTestValue; TCharVal = Ord('A')..Ord('Z') ; Today = (Monday,Tuesday,Wednesday,Thursday,Friday,Saturday, Sunday) ;
delphi网络资源总结,话了重点,方便阅读,记忆
TCount
TPrimaryColor red yellow blue T Delphi implementation
2.1.9
Object Pascal
2.1.2
2.1.9.1
type Tdays=( Sunday
,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday); var
DayOfWeek:TDays; Sunday 0 Monday 1
DayOfWeek TDays DayOfWeeks
delphi网络资源总结,话了重点,方便阅读,记忆
Monday
2.1.9.2 type Thours = 0..23; TValidLetter = 'A' .. 'F'; TDays = ( Sunday ,Monday,Tuesday,Wednesday,Thursday, Friday,Saturday); { } TWorkDay =
Monday..Friday; { TDays } ( Implementation {$R*.DFM}
Options|Project|Complier Options Range Cheking )
2.1.8.4
begin end Result function CalculateInterest(Principal,InterestRate: Double):Double; begin CalculateInterest := Principal * InterestRate; end; Result Result :=
Principal*InterestRate; InterestEarned :=CalculateInterest(2000,0.012); Implementation interface
inplementation uses
delphi网络资源总结,话了重点,方便阅读,记忆
2.1.8.5
Object Pascal NoValue A B B A forword … implementation var alpha:Integer; procedure Test2(var
A:Integer):forword; {Test2 } procedure Test1(var A:Integer); begin A :=A-1; if A>0 then test2(A); { Test2} writeln(A); end;
procedure Test2(var A:Integer);{ Test2 } begin A :=A div 2;
2.1.9.3
Double var Check : array
[1..10] of Double; Check 10 Double 1 10 [] Check 10 Check[1] type TCheck = array[1..10] of Double; var Check :TCheck; 0.0 Check for J := 1 to 10 do Check[J] := 0.0; 20 20
type Ttable = array[1..20,1..20] of Double; var table1:TTable;
delphi网络资源总结,话了重点,方便阅读,记忆
0.0 for var
Col,Row:Integer; … for Col :=1 to 20 do for Row := 1 to 20 do Table1[Col,Row] := 0.0; Check Box Delphi Stdctrls TCheckBox StdCtrls Delphi CDialogs
2.1.10.1 Object Pascal unit < >
interface uses < > 2.1.9.4 { } implementation uses < > type { } MyString: string[15]; { } var initialization { } MyName: MyString; { } MyName 15 Delphi end. 255 MyName := 'Frank.Smith'; 2.1.10.2 MyName := ' '
MyName 15 MyString interface ( ) MyName
delphi网络资源总结,话了重点,方便阅读,记忆
Delphi
‘FrankSmith.Franklin’ Delphi 15 ‘FrankSmith.Fran’ interface
interface MyName
[1] MyName 'F' Unit uses Delphi A UnitB interface Delphi B A interface uses A Concat (+) Copy B B interface uses
C A Delete C B interface A C B A interface Insert Length Pos uses A B interface uses
2.1.9.5
delphi网络资源总结,话了重点,方便阅读,记忆
Caption Label Default True procedure TForm1.Button1Click(Sender:TObject); type Tvowels=set of Char; var Vowels:TVowels; begin Vowels := ['a','e','i','o','u']; if Edit1.Text[1] in Vowels then Lable2.Caption := ' '; else Lable2.Caption := ' '; end; Edit1.Text[1] in Vowels in TVowels
2.1.10.3
implementation interface interface implementation procedure function implementation interface implementation uses
interface implementation udes implementation C B implementation A C
delphi网络资源总结,话了重点,方便阅读,记忆
C A uses
implementation Delphi A implemetation uses B B implementation A
2.1.10.4
interface initialization end
initialization
2.1.9.6
type
TEmployee=record Name : string[20]; YearHired:1990..2000; Salsry: Double;
Position: string[20]; end;
TEmployee var
NewEmployee,PromotedEmployee:TEmployee;
NewEmployee.Salary := 1000; with PromotedEmployee do
begin Name :=''; YearHired := 1993; Salary := 2000.00 Position := 'editor'; end; PromptEmployee := NewEmployee; Delphi (Field) Delphi
正在阅读:
jsj_DELPHI基本语法07-20
关于医院法制宣传日活动总结12-31
校园欺凌作文600字06-18
高新技术企业所得税优惠政策及后续管理807-17
易道教育手脑潜能系列课程04-27
动量守恒定律应用(三)04-23
公共组织绩效评估期末复习题10-17
高原冻土之青藏铁路12-24
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- 语法
- 基本
- DELPHI
- jsj
- 基于转化反应机制的锂离子电池电极材料研究进展
- 常见习惯性违章指挥表现形式及其危害后果和应当采取的防范措施
- 中国人民大学科学研究基金项目经费使用管理办法
- 2013-2018年中国彩棉内衣行业市场分析及投资可行性研究报告
- 2012刑事诉讼法修正案草案的说明 实录
- 第五章 相交线与平行线练习题参考答案
- 第三单元物质构成的奥秘知识点总结
- 实验小学2019年小升初语文毕业考试试卷豫教版C卷 含答案
- 培训效果评估的重要性及方法研究
- 陕南生态旅游发展战略研究(Ⅱ)
- 商业公司预算执行分析报告 模板(2010-5-21)
- Windows XP高考试题集锦(分章)
- 发酵食品生产技术
- 2012年5月红会会员参观南京大屠杀纪念馆策划书1
- 赣锋锂业:股票上市保荐书 2010-08-09
- 某高速公路路基施工安全技术交底
- 《1000kV级架空输电线路张力架线施工工艺导则》验收版资料
- 2011十二星座开运水晶
- 甲级单位编制液压扳手项目可行性报告(立项可研+贷款+用地+2013案例)设计方案
- 《北美自由贸易协定》中文版