delphi 自定义控件_Delphi中的自定义组件开发 向右看齐 2022-12-06 15:45 356阅读 0赞 delphi 自定义控件 [Components][] are essential elements of the Delphi environment. One of the most important features of Delphi is that we can **use Delphi to create our own components**. [组件][Components]是Delphi环境的基本元素。 Delphi最重要的功能之一是我们可以**使用Delphi创建自己的组件** 。 We can derive a new component from any existing component, but the following are the most common ways to create components: modifying existing controls, creating windowed controls, creating graphic controls, subclassing Windows controls and creating nonvisual components. Visual or not, with or without property editor, from scratch...you name it. 我们可以从任何现有组件中派生一个新组件,但是以下是创建组件的最常用方法:修改现有控件,创建窗口控件,创建图形控件,子类化Windows控件以及创建非可视组件。 不论是否可见,无论是否使用属性编辑器,您都可以从头开始...命名。 Developing Delphi components isn't a simple task, it involves quite a bit of knowledge of the VCL. However, developing custom components is not an impossible task; writing components is just pure programming. 开发Delphi组件不是一件容易的事,它涉及VCL的很多知识。 但是,开发自定义组件并非不可能。 编写组件仅仅是纯编程。 ## 文章,论文,教程 **(** Articles, Papers, Tutorials **)** ## What follows is a list of articles that deal with custom component development in Delphi. 以下是有关在Delphi中进行自定义组件开发的文章列表。 * Accessing protected members of a component 访问组件的受保护成员 Many Delphi components have useful properties and methods that are marked invisible ("protected") to a Delphi developer. In this article, you will find the workaround to this problem - thus enabling you to access a DBGrid's RowHeights property, for example. 许多Delphi组件具有有用的属性和方法,这些属性和方法被Delphi开发人员标记为不可见(“受保护”)。 在本文中,您将找到解决此问题的方法-例如,使您能够访问DBGrid的RowHeights属性。 * Creating Custom Delphi Components - Inside and Out 创建自定义Delphi组件-内部和外部 This tutorial will explain component writing to you, which should result in more code reuse. It will go over properties, events, and methods, and will also explain how to install components. The final part of this tutorial is about Object-Oriented design. 本教程将向您介绍组件编写,这将导致更多的代码重用。 它将介绍属性,事件和方法,还将说明如何安装组件。 本教程的最后一部分是有关面向对象设计的。 * [Creating Custom Delphi Components, Part I][Creating Custom Delphi Components_ Part I] [创建自定义Delphi组件,第一部分][Creating Custom Delphi Components_ Part I] This first part demonstrates some of the best approaches to building components, and at the same time provides tips on deciding on the best base class to inherit from, using virtual declarations, the complexities of overriding, and so on. 第一部分演示了构建组件的一些最佳方法,同时提供了使用虚拟声明,重写的复杂性等决定如何从中继承最佳基类的技巧。 * Creating Custom Delphi Components, Part II 创建自定义Delphi组件,第二部分 Quite often it is necessary to write components that perform more advanced functions. These components often need to either reference other components, have custom property data formats, or have a property that owns a list of values rather than a single value. We will explore various examples covering these very subjects, starting with the most simple. 通常,有必要编写执行更多高级功能的组件。 这些组件通常需要引用其他组件,具有自定义属性数据格式或具有拥有值列表而不是单个值的属性。 我们将从最简单的例子开始探讨涵盖这些主题的各种示例。 * Creating Custom Delphi Components, Part III 创建自定义Delphi组件,第三部分 This article is the final part of a three part article on components. Part one covered the basic creating of components, part two covered how to write advanced properties, how to write custom streaming for those properties and sub-properties. This final part will cover property/component editors, how to write dedicated editors for your component/property, and how to write "hidden" components. 本文是有关组件的三部分文章的最后一部分。 第一部分介绍了组件的基本创建,第二部分介绍了如何编写高级属性,如何为这些属性和子属性编写自定义流。 最后一部分将介绍属性/组件编辑器,如何为您的组件/属性编写专用的编辑器以及如何编写“隐藏的”组件。 ## 更多资源 **(** More Resources **)** ## First, if you want more, consider buying a book on Developing custom components.Second, why not try [locating an existing][] (with source perhaps) component you are looking for.Third, when you are 100% sure there is no such question on custom component development you can't answer...there will be something that you don't know. Everything you have to do is to ask a question on the Delphi Programming Forum and wait for answers. 首先,如果您想要更多,请考虑购买一本有关开发自定义组件的书;其次,为什么不尝试[查找][locating an existing]您正在寻找[的现有][locating an existing] (可能带有源代码)组件;第三,当您100%确定没有关于自定义组件的问题时您无法回答的组件开发...会有一些您不知道的事情。 您要做的就是在Delphi编程论坛上提问,然后等待答案。 **Articles, papers, tutorials**Here is a list of articles that deal with custom component development in Delphi. **文章,论文,教程**这是有关Delphi中自定义组件开发的文章列表。 * VCL Component Messages \[RTF\] VCL组件消息\[RTF\] Component Messages (CM\_) are generated only by the VCL and are not reflected Windows Messages (WM\_), as one may assume. In spite of that Component Notifications (CN\_) are reflected Windows Messages. The idea behind it is, that Windows often sends messages to a parent window of a control instead of the control itself. The VCL simply converts (reflects) these messages to Component Notifications and then sends it to the control, for which the message originally was meant. 组件消息(CM\_)仅由VCL生成,不会像假定的那样反映在Windows消息(WM\_)中。 尽管如此,组件通知(CN\_)仍会反映Windows消息。 其背后的想法是,Windows通常将消息发送到控件的父窗口,而不是控件本身。 VCL只是将这些消息转换(反映)为组件通知,然后将其发送给控件(该消息原本是针对此控件的)。 * [Delphi Component Building][]. [德尔福构件建筑][Delphi Component Building] 。 In this article, read about every aspect of Delphi Component building. Design a TTicTacToe component and learn about: how to build our own components for Delphi, how to add properties, methods and custom events to them, how to wrap them around DLLs, how to install them, how to design a palette bitmap and write on-line help to support the component user. 在本文中,阅读有关Delphi Component构建的各个方面的信息。 设计一个TTicTacToe组件,并了解以下内容:如何为Delphi构建我们自己的组件,如何向它们添加属性,方法和自定义事件,如何将它们包装在DLL周围,如何安装它们,如何设计调色板位图并在上面编写在线帮助以支持组件用户。 * Building SuperComponents in Delphi \[download\] 在Delphi中构建SuperComponents \[下载\] SuperComponents, also known as aggregate or compound components, are collections of existing sub-components and their relationships combined into a single component. The collections are typically arranged inside a container parent component that manages the visual layout of the sub-components. 超级组件,也称为集合或复合组件,是现有子组件的集合,它们之间的关系组合成一个组件。 这些集合通常安排在容器父组件内部,该组件管理子组件的视觉布局。 > 翻译自: [https://www.thoughtco.com/custom-component-development-1058382][https_www.thoughtco.com_custom-component-development-1058382] delphi 自定义控件 [Components]: https://www.thoughtco.com/delphi-programming-tutorials-4133473 [Creating Custom Delphi Components_ Part I]: https://www.thoughtco.com/free-delphi-component-sets-1058323 [locating an existing]: https://www.thoughtco.com/installing-a-single-source-delphi-component-1058428 [Delphi Component Building]: http://www.drbob42.com/delphi/componen.htm [https_www.thoughtco.com_custom-component-development-1058382]: https://www.thoughtco.com/custom-component-development-1058382
还没有评论,来说两句吧...