Einzelnen Beitrag anzeigen

Hawkeye219

Registriert seit: 18. Feb 2006
Ort: Stolberg
2.227 Beiträge
 
Delphi 2010 Professional
 
#4

Re: Empfänger bei WM_DROPPFILES unterscheiden

  Alt 5. Mär 2010, 21:28
Hallo Michael,

wenn das Formular die Nachricht WM_DROPFILES empfängt, bezieht sich der DropPoint auf den Client-Bereich des Formulars. Du musst also die Koordinaten auf die Client-Bereiche der Edit-Controls umrechnen (lassen):

Delphi-Quellcode:
var
  DropPoint: TPoint;
begin
  :
  DragQueryPoint(Msg.WParam, DropPoint);
  if IsDropPointInside(DropPoint, edtCarrierFile) then
    edtCarrierFile.Text := DroppedFilename
  else if IsDropPointInside(DropPoint, edtTrailerFile) then
    edtTrailerFile.Text := DroppedFilename;
  :
end;

function TfrmSteganosaur.IsDropPointInside (const aDropPoint: TPoint; const aControl: TControl): Boolean;
begin
  Result := PtInRect(aControl.ClientRect, aControl.ScreenToClient({Self.}ClientToScreen(aDropPoint)));
end;
Gruß Hawkeye
  Mit Zitat antworten Zitat