登录
首页 » Delphi源码 » Delphi 使同类的组件进行同样的操作

Delphi 使同类的组件进行同样的操作

于 2022-05-23 发布 文件大小:5.77 kB
0 200
下载积分: 2 下载次数: 1

代码说明:

Delphi 使同类的组件进行同样的操作的一个实例,类似于将WEB表单统一清空的功能,点击按钮后,所有文本框组件的内容被清空,作用在相同的组件实例上,代码:   procedure TForm1.Button2Click(Sender: TObject);   begin    Close;   end;      procedure TForm1.Button1Click(Sender: TObject);   var    ClearText : Integer;   begin    For ClearText := 0 to Form1.ComponentCount -1 do    begin    //判断如果窗体中包含文本框组件,则将所有文本框组件的内容清空    if Form1.Components[ClearText] is TEdit then    begin    TEdit(Components[ClearText]).Clear;    end;    end;   end;

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 窗口中的弹出式右键菜单-delphi
    窗口中的弹出式右键菜单-delphi PopupMenu源码,   procedure TForm1.Button1Click(Sender: TObject);   var    Poin:TPoint;   begin    Poin := Point(Button1.Left,Button1.Top+Button1.Height);    Poin := ClientToScreen(Poin);    PopupMenu1.Popup(Poin.X,Poin.Y);   end;
    2022-07-24 15:12:59下载
    积分:1
  • 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实现回车移动焦点的功能,当用户在输入时按回车键,将移动光标到一下文本框,这个功能我觉得可很好的提升软件的操作体验,为实现快捷输入近了一步。具体代码请参考如下:   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 使DBGrid支持鼠标滚轮
    Delphi 使DBGrid支持鼠标滚轮,测试前请确保程序已连接好数据库,否则会有很长一段时间反应,读取的数据会显示在DBGrid控件中,请在DBGrid组件中滚动鼠标滚轮,可将整个列表上下滚动,便于浏览数据,这个功能在一些软件中经常会遇到,具体编写思路请下载源码研究。
    2022-04-12 01:26:52下载
    积分:1
  • Delphi 7.0 改变菜单中的字体样式
    Delphi 7.0 改变菜单中的字体样式,本程序其实实现了两种功能,1、枚举系统中所有已安装的字体,并加载到Listbox列表中供选择,2,改变字体样式,选中列表中的任意字体样式,单击即可改变菜单中的文字样式,为窗口中其它区域的文字设置字体样式的时候也可参考。   begin    ListBox1.Items:=Screen.Fonts;字体样式    self.MainMenu1.AutoHotkeys:=maManual;    self.MainMenu1.AutoLineReduction:=maManual;    Screen.MenuFont.Size:=12;字号   end;
    2022-07-27 08:35:14下载
    积分:1
  • Delphi IntToHex函数用法举例
    关于IntToHex,在Delphi中使用频率也是挺高的,不过像我这种菜鸟,对IntToHex的具体用法仍是不太熟悉,后来看了这个小程序,了解了一些,分享给大家,特别是以下代码会加深你对IntToHex函数的用法理解。   procedure TForm1.Button1Click(Sender: TObject);   var    S:integer;   begin    S:=2147483647;    showmessage(inttoHex(s,8));    showmessage(inttoHex(s,10));    showmessage(inttoHex(s,16));    showmessage(inttoHex(s,32));   end;
    2022-09-07 01:20:03下载
    积分: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 获取网页源码
    2023-01-22 10:05:04下载
    积分:1
  • Delphi7 计算汉字的笔划
    Delphi7 计算汉字的笔划有几划,输入一个汉字,本程序将计算出这个字有多少笔划,最后将结果将输出一个整数。
    2022-12-25 04:20:03下载
    积分:1
  • Delphi 使用API函数拔号
    Delphi 使用API函数拔号,拨号程序,基于api的方法实现,有兴趣下载源码参考一番。
    2022-01-26 01:52:58下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载