能否向函数或者过程传递控件?? 我的想法是,通过一个函数或者过程判断该控件后,再处理该控件相应的事件!能否实现?有例子最好 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure HanldeClick(ACon: TWinControl);begin if ACon is TButton then begin (ACon as TButton).OnClick(nil); end;end; unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; CheckBox1: TCheckBox; procedure Button1Click(Sender: TObject); procedure CheckBox1Click(Sender: TObject); procedure Edit1Click(Sender: TObject); private procedure CheckControl(AObject: TObject); public { 公共成员(变量、函数)声明 } end;var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.CheckControl(AObject: TObject);begin if AObject is TButton then ShowMessage('这是一个Button') else if AObject is TEdit then ShowMessage('这是一个Edit') else if AObject is TCheckBox then ShowMessage('这是一个CheckBox');end;procedure TForm1.Button1Click(Sender: TObject);begin CheckControl(Sender);end;procedure TForm1.CheckBox1Click(Sender: TObject);begin CheckControl(Sender);end;procedure TForm1.Edit1Click(Sender: TObject);begin CheckControl(Sender);end;end. Delphi7实现excel文件和txt文件的相互转换 DLL封装的问题 TLabel能不能多行显示啊 怎么在指定的任意位置,打开指定大小的IE浏览器? DELPHI中有没有像VB那样left()、right()类似的截取字符串的函数? OLE在裝入圖片時的問題 在线急等:有关数据库的排序问题!!!!!!解决分全送! wise installation system9.02制作安装程序的问题!急。在线等待! 深空 来吧 程序最小化后任务条中不可见的实现 如何根据程序文件名获取该程序的句柄(如果当前正在系统中运行)?WINXP 有什么方法从 HKEY 句柄中获该句柄的相关信息??
begin
if ACon is TButton then
begin
(ACon as TButton).OnClick(nil);
end;
end;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
CheckBox1: TCheckBox;
procedure Button1Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Edit1Click(Sender: TObject);
private
procedure CheckControl(AObject: TObject);
public
{ 公共成员(变量、函数)声明 }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.CheckControl(AObject: TObject);
begin
if AObject is TButton then
ShowMessage('这是一个Button')
else if AObject is TEdit then
ShowMessage('这是一个Edit')
else if AObject is TCheckBox then
ShowMessage('这是一个CheckBox');
end;procedure TForm1.Button1Click(Sender: TObject);
begin
CheckControl(Sender);
end;procedure TForm1.CheckBox1Click(Sender: TObject);
begin
CheckControl(Sender);
end;procedure TForm1.Edit1Click(Sender: TObject);
begin
CheckControl(Sender);
end;end.