Delphi MessageBox
MessageBox对话框是比较常用的一个信息对话框,其不仅能够定义显示的信息内容、信息提示图标,而且可以定义按钮组合及对话框的标题,是一个功能齐全的信息对话框信息提示图标,而且可以定义按钮组合及对话框的标题,是一个功能齐全的信息对框。 1、函数原型及参数 Read More…
– Charlie.Wang's API site
delphi教程,涵盖了delphi 7到delphi xe各版本,其中作者经常使用delphi xe4和delphi xe7
特别在动态创建控件时,有时经常需要遍历控件。 如果知道控件名称,则可以通过FindComponent – 查找(定位)组件,如果不知道的话,只能遍历控件了。 遍历一个Panel上的所有控件: Var i: integer; begin for i:=0 to Panel1.ControlCount do begin // 控件: Panel1.Controls[i] // 自己的业务逻Read More…
Delphi中的StringReplace函数是SysUtils单元中自带的函数,该函数可以替换字符串中的指定字符。 function StringReplace (const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string; // rfReplaceAll:全部替换 // rfIgnoreCase:忽略大小写 // For Example: var aStr: String; begin aStr := 'This is a book, not a pen!'; Read More…
最近的项目中经常在程序中动态创建控件,势必用到Create。 但是随之而来的问题就是动态创建的控件是否可以正确的释放内存? 以及 Create(nil), Create(self), Create(Application)的区别又是什么呢? Create(nil);//需要自己释放 Create(Self);//当Self释放时自动触发释放 Create(ApplRead More…
unit ALScreenSnap; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ShellAPI; type TALScreenSnap = class(TComponent) private OldWndProc, NewWndProc: Pointer; fActive: Boolean; fThreshold: Integer; procedure NewWndMethod(var Msg: TMessage); public constructor Create(AOwner: TCRead More…
网上搜到的Delphi邮件发送系统,绝大多数是使用SMTP协议来发送。 但是事实上它们已经过时了,大多数邮件服务器已经屏蔽了Delphi Indy的邮件发送,从而导致Delphi发送不成功。 事实上,让Delphi通过Outlook.Application来发送邮件,也是非常方便的,而且没有那么多的限制。 以下是我目前使Read More…
当处理完TreeView控件树形结构的数据后,根据不同的树形节点Level,加上不同的图片。 图片的ImageList已经放置好,并且TreeView的Images已经连上带有图片的ImageList。 除了手动添加图片外,还可以通过代码,根据判断不同Level来批量添加图片,实现代码增加在TreeView的 GetImageIndex Read More…
当处理完TreeView控件树形结构的数据后,需要默认自动全部展开,可以用到TreeView的Expanded属性。 var icount : integer; begin RzTreeView1.Items.EndUpdate; //示例中用的是Raize中的RzTreeView组件 for icount := 0 to RzTreeView1.Items.Count-1 do RzTreeView1.Items[icount].Expanded:=True; RzTreeView1.Items.EndUpdate; end; Read More…
cxGrid默认不显示行号,但是可以通过cxGrid1DBTableView1CustomDrawIndicatorCell事件来重绘行号 选中cxGrid1DBTableView1,在OnCustomDrawIndicatorCell事件中,输入以下代码: procedure TForm1.cxGrid1DBTableView1CustomDrawIndicatorCell( Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);Read More…
根据组件名称,来定位到组件,并且更改组件属性 主要用到Delphi FindComponent 函数 //循环将RzBackground1 – #12的图片改为Sample中的图片 for I := 1 to 12 do begin TRzBackground(FindComponent('RzBackground'+IntToStr(I))).Texture := RzBackground_Sample.Texture; end; //将组件名为ComponentName的标签名改为DMRead More…