Hello, everybody!


Hello, everybody!

I need to put an image into an FMX form, of a desktop application. I've seen that I have at least three options:
TImage, TImageViewer and TImageControl

The Image I need to put is a PNG file of 512x512 pixels with a relatively low quality.

My ask is for people that have experimented with this controls. I've seen the help pages, of course, I've searched on Internet, of course, and I've seen things like his inheritance:

TControl -> TStyledControl -> TCustomScrollBox -> TImageViewer
TControl -> TSyledControl -> TImageControl
TControl -> TImage

What control, based on your experience, is better for this applying and why?

Thank's to all in advance.

Comments

  1. I you need to display a simple image (without borders, scroll bars, etc) use TImage this like a fmx primitive like any other shape (TRectangle, TCircle, TEllipse, TPipe, ...)
    For a image with a control style (border, background, etc) use TImageControl and for Zoom, Scroll, Dialogs, etc use TImageViewer. TImage its simplex (just draw a image over a control where its placed), TSyledControls use a collection of objects to draw and copy values from control properties to style objects. Of course you can use a TRectangle and Fill it with a TBitmap Brush.
    TImage with WrapMode=Original and BitmapMargins empty would call Canvas.DrawBitmap() with any transformation (except screen scale if defined)

    ReplyDelete
  2. Thank you, +Alexander Brazda.
    One more question. I need to link the Image with a TField, with live binding. Do you know what's the best option in this case?

    It's for show an image only, without scrolls nor anything.

    ReplyDelete
  3. I think TImage should work for that you need with LiveBindings.

    ReplyDelete
  4. You can bind any control, as I said before it depends what you need the control for, just display and image, style of image container o a image viewer with zoom, scroll, etc. LiveBinding its to connect data to properties so you can use to connect Integers, Strings, DateTime, Colors or Bitmaps to properties with same type or register a custom transform.

    ReplyDelete

Post a Comment