【例子介绍】
【相关图片】
【源码结构】
录 第 1 章 带您进入 Delphi 世界........................................................................................................1 1.1 什么是 Delphi....................................................................................................................1 1.2 安装和卸载 Delphi............................................................................................................1 1.2.1 安装 Delphi.............................................................................................................1 1.2.2 Delphi 的卸载.......................................................................................................11 1.3 开发环境介绍..................................................................................................................12 1.3.1 用户界面...............................................................................................................12 1.3.2 属性窗口...............................................................................................................13 1.3.3 代码编辑器...........................................................................................................15 1.3.4 项目管理窗口.......................................................................................................16 1.3.5 使用帮助系统.......................................................................................................18 1.4 初窥门径——编写第一个 Delphi 程序.........................................................................18 1.4.1 编程步骤...............................................................................................................18 1.4.2 启动程序...............................................................................................................19 1.4.3 创建程序界面.......................................................................................................20 1.4.4 编写程序代码.......................................................................................................24 1.4.5 保存和编译程序...................................................................................................26 1.5 本章小结 .........................................................................................................................26 第 2 章 编程基础——Object Pascal 语言....................................................................................27 2.1 Object Pascal 的基本语法...............................................................................................27 2.1.1 标识符...................................................................................................................27 2.1.2 编写赋值语句.......................................................................................................30 2.1.3 注释 ......................................................................................................................30 2.1.4 运算符...................................................................................................................31 2.1.5 过程与函数...........................................................................................................33 2.1.6 Pascal 语言的控制语句 .......................................................................................36 2.1.7 枚举、子界、集合和记录...................................................................................39 2.1.8 数组和字符串.......................................................................................................41 2.1.9 Object Pascal 的库单元 Unit................................................................................43 2.2 Object Pascal 技术...........................................................................................................45 2.2.1 类与对象...............................................................................................................45 2.2.2 类与单元...............................................................................................................49 2.2.3 类的继承...............................................................................................................52 2.3 本章小结 .........................................................................................................................52 第 3 章 窗体和组件...............................................................................................................53 3.1 添加窗体 .........................................................................................................................53 3.1.1 添加窗体...............................................................................................................54 ·2· 3.1.2 设置主窗体...........................................................................................................55 3.2 窗体组件 .........................................................................................................................56 3.2.1 窗体的属性、方法和事件...................................................................................56 3.2.2 窗体操作实例.......................................................................................................66 3.3 添加和使用组件..............................................................................................................70 3.3.1 使用显示组件——Label 组件.............................................................................70 3.3.2 使用编辑组件——Edit 组件...............................................................................72 3.3.3 使用按钮组件——Button 组件...........................................................................77 3.4 设置 Tab 键次序..............................................................................................................78 3.5 实战练习——一个有趣的小游戏..................................................................................79 3.6 单文档和多文档窗体......................................................................................................89 3.6.1 单文档窗体...........................................................................................................89 3.6.2 多文档窗体...........................................................................................................93 3.7 菜单的制作......................................................................................................................94 3.7.1 使用菜单设计器建立菜单...................................................................................95 3.7.2 定制各种类型的菜单...........................................................................................97 3.7.3 动态改变菜单.......................................................................................................99 3.8 工具栏 ...........................................................................................................................105 3.9 本章小结 .......................................................................................................................106 第 4 章 常用组件与示例.............................................................................................................107 4.1 文本编辑组件................................................................................................................107 4.1.1 Memo 组件的属性.............................................................................................107 4.1.2 Memo 组件的方法.............................................................................................111 4.1.3 Memo 组件的事件.............................................................................................114 4.2 按钮及其分类组件........................................................................................................114 4.2.1 BitBtn 组件.........................................................................................................114 4.2.2 SpeedButton 组件...............................................................................................115 4.2.3 CheckBox 组件...................................................................................................116 4.2.4 RadioButton 组件...............................................................................................117 4.3 列表组件 .......................................................................................................................117 4.3.1 ListBox 组件.......................................................................................................118 4.3.2 ComboBox 组件.................................................................................................119 4.4 特殊输入组件................................................................................................................121 4.4.1 ScrollBar 组件 ....................................................................................................122 4.4.2 TrackBar 组件.....................................................................................................124 4.4.3 UpDown 组件.....................................................................................................125 4.4.4 HotKey 组件.......................................................................................................126 4.5 信息反馈组件................................................................................................................128 4.5.1 ProgressBar 组件................................................................................................129 4.5.2 StatusBar 组件....................................................................................................130 ·3· 4.6 实战练习——记事本的制作........................................................................................130 4.6.1 主窗体设计.........................................................................................................131 4.6.2 “关于”窗体设计.............................................................................................132 4.6.3 编写程序代码.....................................................................................................133 4.7 本章小结 .......................................................................................................................145 第 5 章 用户界面设计.................................................................................................................146 5.1 对话框的模式................................................................................................................146 5.1.1 模式对话框.........................................................................................................146 5.1.2 无模式对话框.....................................................................................................147 5.2 信息对话框....................................................................................................................149 5.2.1 MessageBox 函数...............................................................................................149 5.2.2 MessageDlg 函数................................................................................................150 5.2.3 MessageDlgPos 函数..........................................................................................151 5.2.4 MessageDlgPosHelp 函数..................................................................................152 5.2.5 ShowMessage 函数.............................................................................................152 5.2.6 InputBox 函数 ....................................................................................................152 5.3 专用对话框....................................................................................................................153 5.3.1 【字体】对话框.................................................................................................153 5.3.2 【查找】对话框.................................................................................................154 5.3.3 【替换】对话框.................................................................................................156 5.3.4 【打开】对话框.................................................................................................157 5.3.5 【颜色】对话框.................................................................................................159 5.3.6 【打印】对话框.................................................................................................160 5.4 本章小结 .......................................................................................................................161 第 6 章 图形图像处理.................................................................................................................162 6.1 画布的通用属性和方法................................................................................................162 6.1.1 TCanvas Object(画布对象)...........................................................................162 6.1.2 TPen Object(画笔对象).................................................................................169 6.1.3 TBrush OBject(画刷对象) ............................................................................170 6.1.4 TColor 属性........................................................................................................171 6.1.5 画布应用实例.....................................................................................................171 6.2 图形图像组件................................................................................................................181 6.2.1 Image 组件..........................................................................................................181 6.2.2 Shape 组件..........................................................................................................182 6.2.3 PaintBox 组件.....................................................................................................182 6.3 图形对象 .......................................................................................................................183 6.3.1 读取图像.............................................................................................................183 6.3.2 保存图像.............................................................................................................184 6.3.3 替换图像.............................................................................................................184 ·4· 6.4 图形图像综合实例........................................................................................................185 6.5 本章小结 .......................................................................................................................188 第 7 章 文件管理 ........................................................................................................................189 7.1 文件类型 .......................................................................................................................189 7.1.1 文本文件.............................................................................................................189 7.1.2 记录文件.............................................................................................................189 7.1.3 无类型文件.........................................................................................................190 7.2 文件基本操作................................................................................................................190 7.2.1 打开和关闭文件.................................................................................................190 7.2.2 读写文本文件.....................................................................................................190 7.2.3 读写记录文件.....................................................................................................191 7.2.4 读写无类型文件.................................................................................................192 7.2.5 文件名操作常用函数.........................................................................................193 7.3 文件操作控件................................................................................................................195 7.4 实战练习——文件管理器............................................................................................197 7.5 本章小结 .......................................................................................................................202 第 8 章 调试程序 ........................................................................................................................203 8.1 调试方法 .......................................................................................................................203 8.1.1 使用内部集成调试器.........................................................................................203 8.1.2 使用断点调试法.................................................................................................203 8.1.3 利用逐行执行代码调试.....................................................................................204 8.2 使用调试窗口................................................................................................................204 8.2.1 断点(BreakPoints)窗口.................................................................................204 8.2.2 调用堆栈(Call Stack)窗口 ............................................................................205 8.2.3 监视列表(Watch List)窗口 ...........................................................................206 8.2.4 局部变量(Local Viariables)窗口...................................................................207 8.2.5 线程状态(Thread Status)窗口.......................................................................207 8.2.6 模块(Moduls)窗口 ........................................................................................208 8.2.7 事件记录(Event Log)窗口............................................................................208 8.3 跟踪调试 .......................................................................................................................209 8.4 本章小结 .......................................................................................................................210 第 9 章 高级组件的使用与示例.................................................................................................211 9.1 文本输入组件................................................................................................................211 9.1.1 MaskEdit 组件....................................................................................................211 9.1.2 RichEdit 组件 .....................................................................................................213 9.2 列表组件 .......................................................................................................................215 9.2.1 TreeView 组件....................................................................................................215 9.2.2 ListView 组件.....................................................................................................218 9.2.3 ImageList 组件 ...................................................................................................220 ·5· 9.3 分组组件 .......................................................................................................................220 9.3.1 GroupBox 组件和 RadioGroup 组件.................................................................221 9.3.2 Panel 组件和 ScrollBox 组件.............................................................................221 9.4 表格显示组件................................................................................................................222 9.4.1 StringGrid 组件...................................................................................................222 9.4.2 DrawGrid 组件 ...................................................................................................224 9.5 多选项卡组件................................................................................................................225 9.5.1 TabControl 组件 .................................................................................................226 9.5.2 PageControl 组件................................................................................................228 9.6 实战练习——快乐五子棋的制作................................................................................229 9.7 本章小结 .......................................................................................................................234 第 10 章 多媒体控制技术...........................................................................................................235 10.1 TMediaPlayer 组件......................................................................................................235 10.1.1 TMediaPlayer 组件的关键属性.......................................................................236 10.1.2 TMediaPlayer 组件的常用方法.......................................................................239 10.1.3 TMediaPlayer 组件的常用事件.......................................................................241 10.2 播放 WAV 和 MP3 文件 .............................................................................................244 10.3 播放 VCD 文件...........................................................................................................245 10.4 实战练习——一个完整的 CD 播放器......................................................................246 10.4.1 CD 播放器应具备的基本功能........................................................................246 10.4.2 CD 播放器完整程序代码................................................................................247 10.5 本章小结 .....................................................................................................................255 第 11 章 API 函数的使用 ...........................................................................................................256 11.1 Win32 API 概论...........................................................................................................256 11.1.1 为何使用 Win32 API........................................................................................256 11.1.2 Win32 API 简介................................................................................................257 11.2 API 函数的声明和调用 ..............................................................................................260 11.3 API 函数示例 ..............................................................................................................261 11.3.1 创建不规则窗体...............................................................................................261 11.3.2 任务栏图标编程...............................................................................................261 11.4 本章小结......................................................................................................................267 第 12 章 数据库概述...................................................................................................................268 12.1 数据库系统概述..........................................................................................................268 12.1.1 数据库的基本概念...........................................................................................268 12.1.2 存取数据...........................................................................................................268 12.1.3 数据库应用程序的开发步骤...........................................................................269 12.2 使用组件访问数据......................................................................................................269 12.2.1 TTable 组件 ......................................................................................................270 12.2.2 TQuery 组件.....................................................................................................274 12.2.3 TDataSource 组件.............................................................................................275 ·6· 12.3 使用数据控制(感知)组件......................................................................................279 12.3.1 数据库网格(TDBGrid)组件 .......................................................................279 12.3.2 数据库导航(TDBNavigator)组件...............................................................280 12.3.3 数据库文本(TDBText)组件........................................................................281 12.3.4 数据库文本编辑(TDBEdit)组件................................................................281 12.4 Database Desktop 的使用............................................................................................282 12.4.1 设置工作目录和私有目录...............................................................................283 12.4.2 创建数据表.......................................................................................................284 12.5 数据库引擎的使用......................................................................................................285 12.6 实战练习——图书管理系统的实现..........................................................................287 12.6.1 设计思路...........................................................................................................287 12.6.2 数据库设计.......................................................................................................287 12.6.3 程序编制...........................................................................................................288 12.7 本章小结 .....................................................................................................................296 第 13 章 网络编程 ......................................................................................................................297 13.1 网络技术基础知识......................................................................................................297 13.1.1 计算机网络概述...............................................................................................297 13.1.2 网络结构和网络通信模型...............................................................................297 13.1.3 TCP/IP 协议及 IP 地址分类............................................................................299 13.1.4 Internet 给我们提供的服务 .............................................................................300 13.2 使用 Delphi 网络组件.................................................................................................301 13.2.1 打开 WWW 浏览器 .........................................................................................302 13.2.2 接收电子邮件...................................................................................................305 13.3 Socket 编程基础..........................................................................................................312 13.3.1 Socket 概述.......................................................................................................312 13.3.2 TServerSocket 和 TClientSocket 组件.............................................................312 13.4 Socket 实战——温馨聊天室......................................................................................314 13.4.1 服务器端的设计...............................................................................................314 13.4.2 客户端的设计...................................................................................................317 13.5 本章小结 .....................................................................................................................319 第 14 章 制作安装程序...............................................................................................................320 14.1 安装程序简介..............................................................................................................320 14.2 制作安装程序..............................................................................................................320 14.2.1 安装 InstallShield .............................................................................................320 14.2.2 制作安装程序...................................................................................................321 14.2.3 执行结果...........................................................................................................327 14.3 本章小结 .....................................................................................................................327
评论