Jump to content

Center UniImage After Loaded From URL At Runtime


andyhill

Recommended Posts

    UniImage1.AutoSize:= True; // DOES NOT WORK
    UniImage1.Url:='images/myimage.png'; // LOADS

    // Work Around below corrects size but need image to be centered
    UniImage1.JSInterface.JSCode('Ext.defer(function(){var el='#1'.el.select("img").elements[0]; '+
                                 'el.style.maxWidth = "100%"; '+
                                 'el.style.height="100%"; }, 20);');

After work around above, UniImage1.Center:= True; now works.

Link to comment
Share on other sites

  • andyhill changed the title to Center UniImage After Loaded From URL At Runtime
  • 2 years later...
1 hour ago, eduardosuruagy said:

I have this problem, it is creating a TUniImage and loading the image at runtime, I leave the properties

     vImage.Center := True;
     vImage.Proportional:= True;

but the image is not centered.

Hi, after loading image try to add this:

TuniImage(YoureUniImage).Invalidate;
TuniImage(YoureUniImage).JSInterface.JSCall('updateLayout', []);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...