delphi 清空某个Form的控件内容,用Tag来判断  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 清空某个Form的控件内容,用Tag来判断


//清空某个Form的控件内容,用Tag来判断
procedure TBN.ClearEdit(Frm:TForm;iTag:integer);
var
  ChildCtrl:TComponent;
  icnt:Integer;
begin
  for icnt:= Frm.ComponentCount - 1 downto 0 do
  begin
    ChildCtrl:=Frm.Components[icnt];
    if (ChildCtrl is TEdit) and (ChildCtrl.tag=iTag) then
      TEdit(ChildCtrl).clear;
    if (ChildCtrl is TRzEdit) and (ChildCtrl.tag=iTag) then
      TRzEdit(ChildCtrl).clear;
    if (ChildCtrl is TCombobox) and (ChildCtrl.tag=iTag) then
      TCombobox(ChildCtrl).Text:='';
    if (ChildCtrl is TRzCombobox) and (ChildCtrl.tag=iTag) then
      TRzCombobox(ChildCtrl).Text:='';
    if (ChildCtrl is TRzButtonEdit) and (ChildCtrl.tag=iTag) then
      TRzButtonEdit(ChildCtrl).Text:='';
    if (ChildCtrl is TRzMemo) and (ChildCtrl.tag=iTag) then
      TRzMemo(ChildCtrl).Text:='';
    if (ChildCtrl is TMemo) and (ChildCtrl.tag=iTag) then
      TMemo(ChildCtrl).Text:='';
    if (ChildCtrl is TRadioGroup) and (ChildCtrl.Tag=iTag) then
      TRadioGroup(ChildCtrl).ItemIndex:=0;
    if (ChildCtrl is TRzButtonEdit) and (ChildCtrl.Tag=iTag) then
      TRzButtonEdit(ChildCtrl).Text:='';
    if (ChildCtrl is TDatetimePicker) and (ChildCtrl.Tag=iTag) then
      TDatetimePicker(ChildCtrl).DateTime:=now;
  end;
end;

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.034284114837646 seconds