Ver Mensaje Individual
  #3  
Antiguo 25-06-2022
elrayo76 elrayo76 is offline
Miembro
 
Registrado: ene 2004
Ubicación: En la tierra, por eso mis archivos en la tierra y no en la nuebe...
Posts: 290
Reputación: 21
elrayo76 Va por buen camino
Buenas, te paso estas dos funciones que yo tengo creadas a ver si te sirven.


Código Delphi [-]
function ShowHint(aText: String): THintWindow;
var
  objHintPos: TPoint;
  objHintBox: TRect;
  strShortHint: String;
  arrShortHint: array[0..255] of Char;

begin
  Result := THintWindow.Create(nil);

  strShortHint := GetShortHint(aText);
  objHintPos := Mouse.CursorPos;  // Obtiene la posición del puntero.

  Inc(objHintPos.Y, 6);
  objHintBox := Bounds(0, 0, Screen.Width, 0);
  DrawText(Result.Canvas.Handle, StrPCopy(arrShortHint, strShortHint), -1, objHintBox,
    DT_CALCRECT or DT_LEFT or DT_WORDBREAK or DT_NOPREFIX);

  OffsetRect(objHintBox, objHintPos.X, objHintPos.Y);
  Inc(objHintBox.Right, 6);
  Inc(objHintBox.Bottom, 2);

  Result.ActivateHint(objHintBox, strShortHint);
end;

procedure RemoveHint(var aHint: THintWindow);
begin
  if Assigned(aHint) then
  begin
    aHint.ReleaseHandle;
    FreeAndNil(aHint);
  end;
end;


Ahora lo que tienes que hacer es poner ShowHint cuando en mouse pasa por encima del botón y cuando se va de ahí arriba usar otro evento y llamara RemoveHint



Si esto lo quieren en todos los botones lo que te aconsejo es que te crees un componente donde nuevo con el botón donde tenga esta funcionalidad. De esta forma solo tienes que pasarle el texto y te desentiendes de lo que pasa con el Hint



Saludos,
El Rayo
__________________
Si tienes una función o procedimiento con diez parámetros, probablemente hayas olvidado uno
Responder Con Cita