在刚刚开始编程阶段,自己一步步编写出一个登录窗体,或是一个能够对数据表记录进行增、删、改的窗体时,会感到非常的兴奋。但随着编程时间和编写项目的增加,会发现这种没有什么技术含量的窗体被不断的重复编写,于是乎开始思考有没有一种一劳永逸的办法可以帮助我们摆脱这种窘境呢?有的朋友或者会说,将这些做成一个标准的窗体存放在某个地主,在需要的时候将其Copy过来,然后略为修改。不可否认,这也是一种方法,但对于一个编程人员来说,这种方法很不专业。另一方法则相对更为专业,就是自已动手编写一个Expert。
Delphi是一个完全开放的开发集成环境,提供了一组ToolsAPI供开发者对其进行扩展(相关单元在Delphi的安装目录下的Source/ToolsAPI/中)。要编写自己的Expert需要引用其中的ExptIntf.pas文件,它定义了一个抽象基类TIExpert,任何自定义的Expert均要继承于他。





















下面对这个类中的方法进行简要的说明
方法名称 | 描述 |
GetName | 子类必须改写此方法,给Expert指定一个唯一的名字 |
GetAuthor | 如果编写的是Form Export或Project Expert则子类必须改写此方法,给Expert指定作者,这个字串将出现在Object Repository中 |
GetComment | 如果编写的是Form Export或Project Expert则子类必须改写此方法,简单描述Expert的用途 |
GetPage | 如果编写的是Form Export或Project Expert则子类必须改写此方法,指定Expert出现在New Item窗体的哪个页面中 |
GetGlyph | 如果编写的是Form Export或Project Expert则子类必须改写此方法,指定Expert在New Item窗体中显示的图标,返回0值表示使用默认图标 |
GetStyle | 子类必须改写此方法,指定Expert类型,只能取以下四个值之一:esStandard, esForm, esProject, esAddIn |
GetState | 如果编写的是StandardExport则子类必须改写此方法,指定显示在Help中的Expert菜单状态 |
GetIDString | 子类必须改写此方法,提供一个不与其他任何Expert冲突的字符串,按照惯例,该字符串格式为CompanyName.ExpertFunction |
GetMenuText | 如果编写的是Standard Export则子类必须改写此方法,指定显示在Help中的Expert菜单标题 |
Execute | 如果编写的是Standard Export、Form Export或Project Expert则子类必须改写此方法,当点击菜单或是New Item中的Expert图标时会执行此方法。 |
下面这个Demo会在Delphi IDE的Help菜单中添加一个菜单项,点击之后会弹出一个对话框显示“This is Expert Demo.”。















































































注:这种从TIExpert继承,来编写Expert的方法,在Delphi6中已经被淘汰了(但这不表示这种方法不可用),取而代之的是使用Open Tools API方式实现。
版权声明:本文为博主原创文章,未经博主允许不得转载。
相关推荐
Delphi Formatter Expert 提供了一系列自定义设置,允许开发者根据自己的项目规范或个人喜好调整代码的缩进、空格、大括号位置等格式。例如,你可以设置是否在每个语句后添加分号,或者大括号是否应放在同一行或新行...
7. **安装与使用**:用户通常可以通过Delphi IDE的插件管理器下载并安装Delphi Formatter Expert,然后在IDE中启用该插件,根据需要配置格式化规则,并在编写代码时随时使用。 总之,Delphi Formatter Expert 2.5.6...
Delphi Main Menu Expert是一款专为Delphi开发者设计的工具,旨在优化和提升Delphi程序主菜单的创建、管理和维护效率。这款"菜单专家"通过集成在IDE(集成开发环境)中,提供了一套直观且高效的界面,使得开发者可以...
标题 "Delphi编写Windows服务程序" 涉及的核心知识点主要集中在使用Delphi这一编程环境来创建能够在Windows操作系统后台运行的服务程序。Windows服务是一种特殊类型的应用程序,它们在没有用户界面的情况下启动,...
标题中的“delphi编写的NTP时间同步软件”指的是使用Delphi编程语言开发的一个应用程序,其功能是实现网络时间协议(Network Time Protocol, NTP)的时间同步。NTP是一种用于在计算机网络上同步时间的标准协议,它...
在描述中提到的"delphi编写的计算器"是一个使用Delphi进行编程的简单计算器程序。这个计算器可能包含了基础的数学运算功能,如加、减、乘、除,也可能扩展到更复杂的计算,如求平方根、对数或三角函数。 在Delphi中...
《Delphi7组件编写者指南》是一本专为Delphi开发者设计的实用教程,它深入浅出地介绍了如何在Delphi 7环境下创建自定义组件。Delphi作为一款强大的对象 Pascal 开发工具,其组件化编程是其核心优势之一。通过编写...
这个“delphi编写的记事本”是一个使用Delphi编程工具构建的简单文本编辑器,它包含了基本的记事本功能,如文本编辑、保存、打开、复制、粘贴等,这些都是日常用户可能需要的基础操作。 在Delphi中创建这样的记事本...
Expert Delphi-Pawel Glowacki-Packt-20170630.epub 本书基于rad studio 10.2 tokyo
标题中的"Delphi 用Automation接口编写OPC客户端"指的是使用Delphi编程语言,通过Automation接口来实现OPC(OLE for Process Control)客户端的应用。OPC是一种标准接口,允许不同的工业自动化软件之间进行数据交换...
在这个场景中,我们关注的是如何使用Delphi这一强大的RAD(快速应用程序开发)工具来编写组件,以扩展ASP(Active Server Pages)的功能。ASP是微软开发的一种服务器端脚本环境,常用于构建动态网页应用。而Delphi则...
以下是对这个Delphi7控件编写实例的详细解析。 1. **控件编写**: 在Delphi中,控件是用户界面(UI)的基础元素,如按钮、文本框、标签等。自定义控件是指开发者根据需求创建的具有特定功能或外观的组件。编写...
Delphi 组件编写指南是 Delphi 编程语言中编写控件的详细指南,对于编写 Delphi 组件的方法进行了详细的阐述,涵盖了组件创建、类库、控件修改、窗口控件、图形控件、子类化 Windows 控件、非可视组件等方面的内容。...
在跨平台的软件开发中,有时我们需要将不同编程语言编写的组件集成在一起,例如使用Qt(C++)或Visual C++(VC)调用由Delphi编译的DLL库。Delphi以其强大的面向对象特性及易用性,在创建高效、快速的Windows应用...
这个工具集被称为"CnWizards",它在Delphi的原有功能基础上添加了一系列实用的功能,使得程序员在编写和调试代码时能够更加便捷。 首先,"CnWizards"的核心特性之一是引入了"begin end"对应关系线图。在Delphi中,...
本篇文章将深入探讨如何使用Delphi来编写安装程序,包括必要的步骤、工具和技巧。 首先,我们需要了解Delphi中用于创建安装程序的组件。常见的有Inno Setup,这是一个开源的安装制作工具,支持与Delphi的集成。Inno...
《Delphi程序员代码编写标准指南》是一份针对使用Delphi编程语言进行软件开发的专业文档,旨在规范和提高代码质量,确保程序的可读性、可维护性和可扩展性。这份指南详细阐述了在使用Delphi编写代码时应当遵循的最佳...
本文将详细介绍一个由个人编写的、内建线程支持的Delphi组件定时器,以及它如何避免原生Timer组件的卡顿问题。 首先,让我们深入理解一下Delphi原生的TTimer组件。TTimer是基于VCL(Visual Component Library)的一...