-
Delphi7 向XML中添加RTTI信息
Delphi7.0 向XML中添加RTTI信息,这个例子挺简单,希望大家喜欢,面向Delphi新手的,高手请绕道哦,下面是本例Delphi向XML中添加RTTI信息的关键性代码:
procedure TForm1.ComponentToDOM(iNode: IXmlNode; Comp: TPersistent);
var
nProps, i: Integer;
PropList: PPropList;
Value: Variant;
newNode: IXmlNode;
begin
nProps := GetTypeData (Comp.ClassInfo)^.PropCount;
GetMem (PropList, nProps * SizeOf(Pointer));
try
GetPropInfos (Comp.ClassInfo, PropList);
for i := 0 to nProps - 1 do
begin
Value := GetPropValue (Comp, PropList [i].Name);
NewNode := iNode.AddChild(PropList [i].Name);
NewNode.Text := Value;
if (PropList [i].PropType^.Kind = tkClass) and (Value 0) then
if TObject (Integer(Value)) is TComponent then
NewNode.Text := TComponent (Integer(Value)).Name
else
ComponentToDOM (newNode, TObject (Integer(Value)) as TPersistent);
end;
finally
FreeMem (PropList);
end;
end;
- 2022-01-26 03:00:57下载
- 积分:1
-
Delphi 如何定义自已的鼠标单击事件
Delphi 如何定义自已的鼠标单击事件,本程序定义了监测鼠标中轮的事件,当用户按下鼠标中轮时,将监测到运作类型,并弹出窗口返回结果。
- 2022-05-13 22:55:23下载
- 积分:1
-
Delphi 简单获取Windows时间的例子
简单获取Windows时间-Delphi源代码,改时间的小程序,在Windows自带的时间管理中也可完成系统时间的修改,这个只是一个帮助了解Windows与Delphi编程的例子,如何通过Delphi的程序来修改Windows时间,大致就是这样实现的。可参见以下源码:
procedure TForm1.Button1Click(Sender: TObject);
var
Dtimer : TSystemTime;
hh,Ghh : Integer;
begin
hh := StrToInt(Trim(Edit4.Text));
if hh < 8 then
Ghh := 16 + hh
else
Ghh := hh - 8;
with Dtimer do
begin
wYear:=StrToInt(Edit1.Text);
wMonth:=StrToInt(Edit2.Text);
wDay:=StrToInt(Edit3.Text);
wHour:=Ghh;
wMinute:=StrToInt(Edit5.Text);
wSecond:=StrToInt(Edit6.Text);
end;
SetSystemTime(Dtimer);
end;
- 2022-07-09 18:55:23下载
- 积分:1
-
delphi开发的谷歌翻译工具内含源码
delphi开发的谷歌翻译工具,使用该工具可以不用打开浏览器,然后输入谷歌翻译地址才能进行翻译工作,
而这个工具可以快速打开并直接在文本框中输入你要翻译的文本内容即可翻译了。
同时,你拿到此源码还可以进行二次开发,以满足你更多需要和想象。
- 2022-01-25 22:56:02下载
- 积分:1
-
Delphi获取和设置汉字输入法
Delphi 获取系统中已安装的中文输入法,判断是否在中文状态,若是则关闭它,切换半角和全角模式,切换中文标点模式和英文标点模式,并对输入法做相关设置。以下是相关代码:
procedure TForm1.closecid;
var
mycid:hkl;
begin
mycid:=GetKeyBoardLayOut(0);
if ImmIsIME(mycid) then
//判断是否在中文状态,若是则关闭它
immsimulateHotkey(handle,IME_CHotKey_IME_NonIME_Toggle);
end;
procedure TForm1.FormShow(Sender: TObject);
var
j:integer;
begin
for j:=0 to screen.imes.count-1 do
begin
//获取系统中已安装的中文输入法
ComBoBox1.Items.Add(screen.Imes.strings[j]);
end;
end;
- 2022-10-19 03:05:03下载
- 积分:1
-
Delphi 设定Windows屏幕分辨率的方法和示例代码
Delphi 设定Windows屏幕分辨率的方法和示例代码:
function TForm1.DynamicResolution(X, Y: word): BOOL;
var
lpDevMode: TDeviceMode;
begin
Result := EnumDisplaySettings(nil, 0, lpDevMode);
if Result then
begin
lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth := X;
lpDevMode.dmPelsHeight := Y;
Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end
- 2023-04-22 01:05:03下载
- 积分:1
-
使用Delphi 制作无闪烁的动画效果
使用Delphi 制作无闪烁的动画效果,如何实现不闪烁的动画呢?这个例子或许能找到一些答案:部分代码如下:
var
x,i: Integer;
dir,run: Boolean;
begin
b := TBitMap.Create;
b.Width := AnimWindow.Width;
b.Height := 32;
b.Canvas.Pen.Color := clBtnFace;
b.Canvas.Brush.Color := clBtnFace;
b.Canvas.Rectangle(0,0,AnimWindow.Width,32);
run := True;
dir := False;
x := 0;
while run do
for i := 0 to AnimWindow.ImageList1.Count-1 do
begin
b.Canvas.Rectangle(0,0,AnimWindow.Width,32);
AnimWindow.ImageList1.Draw(b.Canvas,x,0,i);
Synchronize(DrawAnimPic);
Sleep(AnimWindow.SpinEdit1.Value);
if (x = 0) or (x = 300) then dir := not dir;
if dir then Inc(x) else Dec(x);
end;
b.Free;
end;
- 2023-03-22 21:40:04下载
- 积分:1
-
指纹开发源代码
中控指纹delphi开发实例,完成了指纹采集,数据库指纹模块保存和比对
(In the control fingerprint the delphi developers instances, complete fingerprint acquisition, the database fingerprint module save and comparison)
- 2022-10-15 02:05:03下载
- 积分:1
-
Delphi版智能图片放大器
Delphi版智能图片放大器,用滑块改变放大倍率,向左滑,则放大位数变大,反之则变校打开程序后,鼠标在图片区域移动,即可把鼠标悬停区域的图像放大显示N倍,放大位数就是刚才提到的,滑块来调整的放大位数,部分代码可参考如下:
Const //定义放大的区域
dSide=50;//区域大小
var
sSide: Integer;//放大比例[1至100],1为最大100为缩小
msHide: Boolean;
OldX,OldY,NewX,NewY: integer;
Dest,Source: TRect;
{$R *.DFM}
Procedure TForm1.ImageFD(x,y,Side: Integer);//定义放大区域及放大过程
begin
sSide:=30; //初始化放大比例
msHide:=True;
//Canvas.CopyMode:=cmSrcCopy;
image1.Picture.Assign(image2.Picture);
end;
详细情况请下载源码后查看Unit1.pas文件。
- 2023-04-17 17:00:04下载
- 积分:1
-
Delphi 进程通讯的实现实例源码
这是一个Delphi利用自定义消息实现的进程内部通讯的例子,附上了完整的源码,运行的效果如图所示。
本程序作者:王毅 , 陈立亮 , 刘蓉,在Windows2000环境下用Delphi6.0调试通过。
本例子中主控程序采用FindWindow()函数找寻底层工作程序,从而实现通讯。底层工作程序在调试时请先生成可执行文件,然后关闭Delphi编辑器,运行可执行文件进行调试。如果不关闭Delphi编辑器,底层工作程序窗口在处于最小化时将无法正常工作,因为FindWindow()返回的是Delphi编辑器中该窗口的句柄。
- 2022-07-04 09:38:31下载
- 积分:1