我该怎么做?才能知道是那个stringgrid的对应行,主要是知道是那个stringgrid?
解决方案 »
- Delphi automation 怎么和脚本(vba,js)传递数组
- excel数据导入的问题
- 大家帮我看看这个字符串问题
- 请教个关于DELPHI帮助文件的问题
- 为什么TLabel控件的文字会显示不全了,有没有解决的好办法?请各位指点
- 急,急,急,一个很奇怪的问题是关于Dll的????
- 一个算法的问题,高分求救!!
- 使用olecontainer时,如何在运行时指定 OLE对象?
- 请问怎样得到一个字符的ASCII码(即该功能的函数)?多谢了.
- 请问各位高手们,how to 在delphi中实现把unicode纯文本转成ani纯文本?
- 到何处下载一些delphi的秘笈,葵花宝典之类的帮组文档??
- 使用tbgrid通过query显示数据库表中的数据,但当数据一多,比如上万条,那么显示响应很慢,怎么办?
yourgrid.col是列。yourgrid.Name属性就可以知道是那个了。
当然你要设定好TAG值了。
如:STRINGGRID1 TAG:1
STRINGGRID2 TAG:2
STRINGGRID3 TAG:3
..
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
Temp: Tcomponent;
begin
for I := ComponentCount - 1 downto 0 do
begin
Temp := Components[I];
if (Temp is Tstringgrid) then
begin
showmessage(inttostr(temp.tag));
end;
end;end;
你可以试试PopupMenu1.PopupComponent下面是我刚刚试写的代码,其中PMNCaption是PopupMenu1的一个菜单项
procedure TForm1.PopupMenu1Popup(Sender: TObject);
begin
if (PopupMenu1.PopupComponent=StringGrid1) then
begin
PMNCaption.Caption :='OhMyGod';
end
else
begin
PMNCaption.Caption :=(PopupMenu1.PopupComponent As TControl).Name;
end;
end;
begin
if (ActiveControl is TStringGrid) then
showmessage(IntToStr(TStringGrid(ActiveControl).Tag));
end;
StringGrid2.Tag:1
StringGrid3.Tag:2
if (ActiveControl is TStringGrid) then
case TStringGrid(ActiveControl).Tag of
0://to do
1://to do
2://to do
end