ImageEn, unit iemview

TImageEnMView.OnDrawCanvas

TImageEnMView.OnDrawCanvas


Declaration

property OnDrawCanvas: TIEOnDrawCanvas;


Description

Occurs whenever the component canvas is updated.


Example

// Show warning when there is no content to display
procedure TMainForm.ImageEnMView1DrawCanvas(Sender: TObject; ACanvas: TCanvas; ARect: TRect);
var
  s: string;
  tw, th: Integer;
begin
  if ImageEnMView1.ImageCount = 0 then
  begin
    ACanvas.Font.Color := clGray;
    ACanvas.Font.Style := [fsBold];

    s  := 'No images to display';
    tw := Canvas.TextWidth( s );
    th := Canvas.TextHeight( s );
    ACanvas.TextOut( ( ARect.Right - tw ) div 2, ( ARect.Bottom - th ) div 2, s );
  end;
end;