ImageEn, unit imageenview

TImageEnView.SetInteractionHint

TImageEnView.SetInteractionHint


Declaration

procedure SetInteractionHint(const Text: String; x, y: Integer; const minText: String = ''; Center: Boolean = False);


Description

Specify a text hint to appear over the ImageEnView (which will be displayed at the next painting event).

Parameter Description
Text Text to draw
x Horizontal position
y Vertical position
minText Example (dummy) text to calculate the minimum text size
Center If true, x specifies the horizontal center of the hint

Note:
 The font for the hint is specified by DefaultDialogFont
 The styling of hints is specified by HintStyle
 Has no effect unless EnableInteractionHints = True.
 Pass an empty string to clear the hint
 Call Paint to draw the hint


Example

// display current position in pixels
procedure TForm1.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  xx, yy: integer;
begin
  xx := ImageEnView1.XScr2Bmp(X);
  yy := ImageEnView1.yscr2bmp(Y);
  if (xx >= 0) and (xx < ImageEnView1.IEBitmap.Width) and (yy >= 0) and (yy < ImageEnView1.IEBitmap.Height) then
  begin
    ImageEnView1.SetInteractionHint( Format('%d,%d', [xx, yy]), X, Y, '0000,0000' );
    ImageEnView1.Paint();
  end
  else
  begin
    // Clear hint
    ImageEnView1.SetInteractionHint( '', 0, 0 );
    ImageEnView1.Paint();
  end;
end;