Delphi 셀이 선택되었는지 판단

626 단어 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; 

좋은 웹페이지 즐겨찾기