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 系统长文件名与dos形式短文件名的相互转换

Delphi回调函数高级应用

Delphi获取系统进程和路径

Delphi线程中动态创建ado控件

Delphi listview 导出excel txt vcf 单元

Delphi windows 底下根据一个进程的名字杀死一个进程的代码

Delphi webbrowser1使用进度条查看浏览器状态

Delphi格式化输出函数

Delphi中使用汇编(关于pos函数的问题)

Delphi+sql数据库增加,删除,修改,查询操作

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



打赏

取消

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

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

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

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

评论

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