delphi 遍历所有Edit控件


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    btnDo: TButton;
    procedure btnDoClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnDoClick(Sender: TObject);
var
  i: integer;
begin
  for i := 0 to ComponentCount - 1 do
  begin
    if (Components[i] is TEdit) and (TEdit(Components[i]).color = clred) then
      TEdit(Components[i]).Left := TEdit(Components[i]).Left + 5;
  end;
end;

end.

相关阅读 >>

Delphi 使用firedac tfdibbackup和tfdibrestore备份和还原firebird

Delphi xe 程序瘦身.编译后exe最低90kb

crossbow病毒开放源代码-熊猫烧香源始代码

Delphi 64位汇编编程

Delphi 实现检测线程类tthread是否结束

Delphi 取最前窗口标题(不重复)

Delphi 压缩图片(bmp、jpg、png)

Delphi 一行关键代码阻止360云查杀

Delphi 不管什么datetime日期格式时间格式转换都不会错了

Delphi 技巧 以相同类名派生一个子类

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...