Ver Mensaje Individual
  #2  
Antiguo 05-05-2005
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.286
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Programar en cualquier componente de pantalla que se desee que responda al click el siguiente código en el
evento MouseDown.

Código Delphi [-]
  procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
                                  Shift: TShiftState; X, Y: Integer);
 var
    h: HMENU;
   p:TPoint;
 begin
Código Delphi [-]
// El componente que llama deriva de TControl?
   if (Sender is TControl) then begin
      // POsicion del click
     p.X := x;
     p.Y := y;
     // Calculamos las coordenadas relativas
     P := Self.ScreenToClient(TControl(Sender).ClientToScreen(P));
 
     // Mostrar el menú
     h := GetSystemMenu(handle, false);
     TrackPopupMenu(h, TPM_LEFTALIGN or TPM_LEFTBUTTON,
       ClientOrigin.X + p.X ,
       ClientOrigin.Y + p.y, 0, handle, nil);
 end;
 end;
  

__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita