Search code examples
windowsuser-interfacedelphifiremonkey

How do I get rid of these weird margin lines in my edit boxes in Delphi FMX


I have this app in Delphi FMX that works great on my desktop. But, after I implemented a dynamic resizing function for the app's window, all of my edit boxes and buttons have these margin lines in them that I can't seem to get rid of.

Has anyone seen these before, or have any insight on how to get rid of them?

I've looked in the properties tab for each edit box and button. The margins are set to 0, and none of the other properties stick out as a culprit.

Weird Margin Lines Image


Solution

  • It looks like scaling causes this kind of distortion for (system default?) style that uses BitmapLinks, which you can try to "fix" using the BitmapLinks Editor in the Style Designer. Try editing the default style for each control's state and resolution, like this:

    1. Find the "problem" style object (it is background for EditStyle)

    1. Find the property with TBitmapLinks and press the three dots

    1. Check each state in the Links list and each required resolution (at least 1,00 x) matching the blue squares with the yellow ones as indicated by the arrows

    1. Make sure all the links look like this, apply the changes and see if you still have a problem

    Or, even better, you can create your own vector-based style by using the TRectangle as a background:

    A more global way to prevent this kind of distortion is to force GDI+ with FMX.Types.GlobalUseDirect2D := false; before Application.Initialize; in your .dpr file. Sometimes this will help. However, it may cause further display problems.