随笔分类 -  Delphi-VCL源码研究

摘要:最近在用win32写《visual C++经典游戏程序设计》中的扫雷游戏,在写到鼠标点击雷区的时候用到了SetCapture,和ReleaseCapture这对系统函数。 那么为什么需要用到鼠标捕获的函数呢? 我错误地认为鼠标的跟踪可以由Point进行传值处理,就能实现我想要的功能,但是我却疏忽了如 阅读全文
posted @ 2018-04-27 19:37 findumars 阅读(926) 评论(0) 推荐(0) 编辑
摘要:IOC英文为 Inversion of Control,即反转模式,这里有著名的好莱坞理论:你呆着别动,到时我会找你。Ioc模式是解决调用者和被调用者之间关系的模式,可以有效降低软件的耦合度,并适合团队开发,使用这种模式需要首先设计一个好的框架,也可以称之为IoC容器(可能这样的说法在Java世界更 阅读全文
posted @ 2017-01-20 23:51 findumars 阅读(1017) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/kfarvid/archive/2009/10/19/1586229.html 阅读全文
posted @ 2016-10-12 00:33 findumars 阅读(1903) 评论(0) 推荐(0) 编辑
摘要:ddd 阅读全文
posted @ 2016-04-13 20:37 findumars 阅读(190) 评论(0) 推荐(0) 编辑
摘要:这是它的声明,它的数据成员全部都是Event,而没有真正意义上的数据(如此一来,几乎可以猜测,它本身什么都做不了): 它的构造函数平淡无奇: 它的秘密在于:一旦使用了这个控件,那么就会引入AppEvents单元,因此会执行: 其中GroupDescendentsWith函数来自classes.pas 阅读全文
posted @ 2016-04-06 18:33 findumars 阅读(1655) 评论(0) 推荐(0) 编辑
摘要:注意,这些函数只有Private一种形式(也就是不允许覆盖,但仍在动态表格中): 其中TWinControl对TControl有10个消息进行了覆盖(红色标记),其中有2个是WM_消息,8个是CM_消息。 再看它的WndProc函数: 当然还有DefaultHandler: 这样算下来,TWinCo 阅读全文
posted @ 2016-03-30 22:36 findumars 阅读(1117) 评论(0) 推荐(0) 编辑
摘要:注意,这些函数只有Private一种形式(也就是不允许覆盖,但仍在动态表格中)(特别注意,这里居然没有WM_PAINT函数): 同时把它的WndProc列出来,这样它能处理的消息就齐了: 当然还有DefaultHandler: 我还特意查了一下Delphi 5.0和Delphi 7.0的差别,主要就 阅读全文
posted @ 2016-03-30 22:25 findumars 阅读(1084) 评论(0) 推荐(0) 编辑
摘要:ddd 阅读全文
posted @ 2016-03-19 00:22 findumars 阅读(182) 评论(0) 推荐(0) 编辑
摘要:先观赏一下最后的实现效果:     VCL的实现代码: 存储Left与Top的值。另外Height和Width是在哪里存储的? 存储IsControl的值,但是我怎么没见到? 存储DesignSize的值 写入三个值,但是我怎么没见到? 写入Data的二进制数据 写入Data的二进制数据 其中T 阅读全文
posted @ 2016-03-13 20:57 findumars 阅读(775) 评论(0) 推荐(0) 编辑
摘要:说明: Initialize is the first method called by the project source file. It calls the InitProc procedure pointer. By default, the call to Initialize for 阅读全文
posted @ 2016-03-10 18:38 findumars 阅读(1171) 评论(0) 推荐(0) 编辑
摘要:TOperation = (opInsert, opRemove); TComponentState = set of ( csAncestor The component was introduced in an ancestor form. Only set if csDesigning is 阅读全文
posted @ 2016-02-13 19:18 findumars 阅读(925) 评论(0) 推荐(0) 编辑
摘要:{ New TControlStyles: csNeedsBorderPaint and csParentBackground. These two ControlStyles are only applicable when Themes are Enabled in applications o 阅读全文
posted @ 2016-02-08 19:06 findumars 阅读(467) 评论(0) 推荐(0) 编辑
摘要:TControlState = set of (csLButtonDown, csClicked, csPalette, csReadingState, csAlignmentNeeded, csFocusing, csCreating, csPaintCopy, csCustomPaint, cs 阅读全文
posted @ 2016-02-08 19:05 findumars 阅读(358) 评论(0) 推荐(0) 编辑
摘要:前两天编码遇到了要使用FindChildControl方法获取指定名称的TSpeedButton按钮,结果折腾了半天就是没得结果(基础不扎实,呵呵),于是赶紧搜索了下,补习关于这两个方法的用法。 TWinControl类的FindChildControl方法在FWinControls中查找返回指定名 阅读全文
posted @ 2016-02-08 18:53 findumars 阅读(1299) 评论(0) 推荐(0) 编辑
摘要:函数重载重载的思想很简单:编译器允许你用同一名字定义多个函数或过程,只要它们所带的参数不同。实际上,编译器是通过检测参数来确定需要调用的例程。下面是从VCL 的数学单元(Math Unit)中摘录的一系列函数: [delphi] view plain copy function Min (A,B:  阅读全文
posted @ 2016-02-05 23:12 findumars 阅读(545) 评论(0) 推荐(0) 编辑
摘要:ddd 阅读全文
posted @ 2016-02-05 06:56 findumars 阅读(200) 评论(0) 推荐(0) 编辑
摘要:elphi 窗体函数SetWindowLong - 改变指定窗口的属性 原型: 1 2 3 4 5 LONG SetWindowLong( HWND hWnd, // handle to window int nlndex, // offset of value to set LONG dwNewL 阅读全文
posted @ 2016-02-05 06:43 findumars 阅读(201) 评论(0) 推荐(0) 编辑
摘要:再具体一点,就是TWinControl一般情况下不需要Canvas和Paint(TForm是个例外),而TCustomControl自带这2个。 同时开发者应该使用TGraphicControl,而不是TControl。TControl只是图形控件和句柄控件的共同功能的抽象,用来做很多杂事,比如鼠标 阅读全文
posted @ 2016-02-05 06:36 findumars 阅读(666) 评论(0) 推荐(0) 编辑
摘要:意外注意到这个小细节: procedure TControl.WMLButtonUp(var Message: TWMLButtonUp); begin inherited; // 注意,如果是直接点击Form1,会执行TCustomForm.DefaultHandler(var Message); 阅读全文
posted @ 2015-08-25 20:41 findumars 阅读(225) 评论(1) 推荐(0) 编辑
摘要:TWinControl = class(TControl) property ParentWindow: HWnd read FParentWindow write SetParentWindow;// 注意它的参数是windoows句柄,而不是Win控件,适合于那些不需要父控件管理内存释放的子控... 阅读全文
posted @ 2015-08-23 02:23 findumars 阅读(2364) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示