当前位置:主页>仓库管理软件> 列表

Tag属性的意思 找软件销售合同

仓库管理软件版1楼: 我看到很多的控件有Tag属性,但是不会用,请各位大侠解释解释!!
[:)]

2楼: 我一般是用Tag来存储一些临时的一些数据,其实Tag本来的意思我也不清楚,但是Tagh确实很好用哦。 如软件销售合同

3楼: unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button3Click(Sender: TObject);
begin
if Sender is Tbutton then
case Tbutton(Sender).Tag of
0: ShowMessage(TButton(Sender).Name); //button1.name button1.tag=0
1: ShowMessage(TButton(Sender).Name); //button1.name button2.tag=1


2: ShowMessage(TButton(Sender).Name); //button1.name button3.tag=2
end;
end;

end.

4楼: 补充:button1 button2 的onClick都指定到button3Click上.

5楼: tag
金山詞霸说--
n.
标签, 鞋带、绳子等末端的金属物, 垂下物, 附属物, 名称, 标记符, 陈词滥调, 结束语
vt.
加标签于, 紧随, 添饰, 起浑名, 连接
vi.
紧随

可以猜测,宝兰增加这个tag属性就是为了存储一个控件标记的,通常我们并不用它,从TComponect开始这个属性就有了,配合向上转型有时可得到灵活的编程方式,要例子看FlyDayDream的跟帖就行了

6楼: 给你个存Integer型变量的地方而已,
怎么就不是个String型的,那能存放的东西就多多了。

仓库管理软件版7楼: tag是个标签,可以给当前控件附加一个存储附加信息的地方。
如,在一个数据输入窗口中,一个editProvince.text中显示省份的名称,如“山东省”,
然后给editProvince.tag中记录“山东省”在DB中的ID,如37.

说到这里,很不幸的是,这个tag只能是integer类型的。而c#,借鉴了这个tag,但类型是
object的,也就是说,它可以记录任意的东西,任意多的东西。

8楼: 多人接受答案了。