`

Delphi判断单元格是否被选中

阅读更多
function IsCellSelected(StringGrid : TStringGrid; X, Y : LONGINT): BOOLEAN; 
begin 
 Result := false; 
 try 
  if (X >= StringGrid.Selection.Left) and (X <= StringGrid.Selection.Right) and (Y >= StringGrid.Selection.Top) and (Y <= StringGrid.Selection.Bottom) 
  then 
  Result := true; 
 except 
 end; 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  if IsCellSelected(Stringgrid1,2,2) then 
  begin 
  ShowMessage('Cell 2,2 is selected'); 
  end; 
end; 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics