-
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 让组件拖动窗体 按钮拖动窗口移动,如图所示的窗口中,用户只需按住按钮,即可将整个窗口在屏幕上随意拖动,实现了如何用组件来移动窗体的功能。下面是相关代码:
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=MBLeft then
begin
releasecapture;
PerForm(WM_SYSCOMMAND,$F012,0);
end;
end;
- 2023-03-07 20:25:03下载
- 积分:1
-
Delphi 当鼠标和键盘在一定时间没有动作时关闭程序
Delphi 当鼠标和键盘在一定时间没有动作时关闭程序,这是一个智能化程序,类似于屏保,当一定时间没有操作时,会关闭软件,运行的技术也不很高深,有兴趣的可下载源代码研究学习。
- 2022-10-11 13:05:03下载
- 积分:1
-
Delphi 获得汉字区位码的源码
Delphi 获得汉字区位码的源码,输入指定汉字,将得到这些汉字的区位码,关键代码请参考以下的源码:
procedure TForm1.Button1Click(Sender: TObject);
var
str:string;
hi,lo:integer;
begin
str:=trim(edit2.Text);
hi:=byte(str[1])-$a0;
lo:=byte(str[2])-$a0;
edit1.Text:=inttostr(hi)+inttostr(lo);
end;
- 2022-02-21 00:07:08下载
- 积分:1
-
Delphi 文件目录操作
一个基础的Delphi 文件目录操作示例,这里是拷贝指定的文件夹目录,一是了解复制文件的原理,二是熟悉Delphi中的目录操作技巧。
- 2022-03-15 15:35:17下载
- 积分:1
-
delphi windows远程桌面链接源码,带代理功能,支持win2012
delphi windows远程桌面链接源码,带代理功能,支持win2012 原创代码
- 2023-02-10 08:55: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实现回车移动焦点的功能,当用户在输入时按回车键,将移动光标到一下文本框,这个功能我觉得可很好的提升软件的操作体验,为实现快捷输入近了一步。具体代码请参考如下:
begin
if Key = 13 then
begin
keybd_event(VK_TAB,0,KEYEVENTF_EXTENDEDKEY,0); //按下
keybd_event(VK_TAB,0,KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP,0); //弹起
end;
end;
- 2022-08-21 20:36:32下载
- 积分:1
-
Delphi 利用API绘制弧形
Delphi 利用API绘制弧形,
begin
ArcRect := ClientRect;
Canvas.Pen.Width:=2;
for i:=1 to 10 do
begin
Arc(Canvas.Handle,ArcRect.Left,ArcRect.Top,ArcRect.Right,
ArcRect.Bottom,ArcRect.Right,(ArcRect.Bottom-ArcRect.Top) div 2,
ArcRect.Left,(ArcRect.Bottom-ArcRect.Top) div 2);
InflateRect(ArcRect,-2,-2);
Canvas.Pen.Color := PaletteIndex(i+10);
end;
- 2022-03-21 03:44:09下载
- 积分:1
-
内存使用状态Delphi 探测并显示
Delphi获取内存的使用状态并显示信息,这里是使用GlobalMemoryStatus来实现,有的是使用GetSystemInfo来获龋本程序可显示内存大小和可用内存,并显示进度条。不过我这台电脑是16G内存的Windows7 64位系统,程序可能没认出啊,下面是识别内存可用量的大小,仅供参考:
memo_status.dwLength := sizeof(memo_status);
GlobalMemoryStatus(memo_status);
Gauge2.Progress := (round((100*(memo_status.dwAvailPhys
/ memo_status.dwTotalPhys))));
label1.Caption := inttostr(memo_status.dwAvailPhys);
label2.Caption := inttostr(memo_status.dwTotalPhys);
- 2022-02-03 06:55:31下载
- 积分:1