我现在用到Stringgrid,希望能够在运行时候鼠标移动到一格时能显示出那一格的行列,就像showHint一样,只不过Hint的内容是当前我鼠标移动到的那格的行列,请问可以实现吗?
解决方案 »
- xp下可以设置按关机按钮“问我做什么”,这个触发什么事件,或是发送什么消息?
- 有挑战性:字符串数组,或者TStringList,在记录数很多时,如何快速把重复的记录找出来?
- 大家看看我写的这个自定义函数错在哪里?
- 我遇到感情问题了,我该怎么办啊!
- 哪里可以下载Wise Installer支持Oracle 8.17的BDE的安装
- 寻觅Delphi爱好者,顺便问一个问题
- adoquery 的 update 问题
- 在线等待,关闭mdi子窗体的时候为什么是最小化,关不上
- 请问var里面的错误
- 怎样把stringgrid相邻CELLS的分隔线取消掉?
- delphi 让ActionList里的action失效
- 用CreateOleObject创建的WORD文档弹出模态的预览窗体
var
c,r: Integer;
begin
c := StringGrid1.Col; {当前列}
r := StringGrid1.Row; {当前行}
StringGrid1.Cells[c,r] := Format('列:%d;行:%d', [c,r]);
end;
StringGrid1.Col;//列
StringGrid1.Row;//行
procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
i,j,m,n,k,l:Integer;
begin
self.vg_cou:=self.vg_cou+1;
self.Label2.Caption:='触发事件'+inttostr(self.vg_cou);
m:=y div self.StringGrid1.DefaultRowHeight;
n:=y mod self.StringGrid1.DefaultRowHeight;
if n>0 then
m:=m+1;
self.Label1.Caption:='行号:'+inttostr(m);
i:=self.StringGrid1.ColCount;
k:=0;
for j:=0 to i-1 do
begin
l:=k;
k:=k+self.StringGrid1.ColWidths[j];
if (x>l) and (x<k) then
begin
self.Label7.Caption:='列号:'+inttostr(j+1);
Break;
end;
end;
end;