Ver Mensaje Individual
  #7  
Antiguo 10-11-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Pues por ahí hubiéramos empezado porque un Shape no es un WinControl. Lo único que se me ocurre es hacer un función que recorra todas las componentes del formulario y si es un Shape, vea si el ratón está sobre él:

Código Delphi [-]
function TForm1.FindShape(const Pos: TPoint): TShape;
var
  I: Integer;

begin
  Result := nil;

  for I := 0 to ComponentCount - 1 do
  begin
    if Components[i] is TShape then
    begin
      if PtInRect(TShape(Components[i]).BoundsRect, Pos) then
      begin
        Result := TShape(Components[i]);
        break;
      end;
    end;
  end;
end;

procedure TForm1.AppEventsIdle(Sender: TObject; var Done: Boolean);
var
  Shape: TShape;

begin
  Shape := FindShape(ScreenToClient(Mouse.CursorPos));

  if Assigned(Shape) then
    Caption := Shape.Name;
end;

No pongo ahora ejemplo en C porque mi turbo explorer se acaba de quedar congelado

// Saludos
Responder Con Cita