# Widget buttons changing shape...

**URL:** <https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Widget, question\
**Created:** [September 25, 2023, 3:08pm UTC](https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608 "2023-09-25T15:08:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yellow5actual](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yellow5actual/32/755451_2.png) [@Yellow5actual](https://forums.unrealengine.com/u/Yellow5actual)\
**Post date:** [September 25, 2023, 3:08pm UTC](https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608/1 "2023-09-25T15:08:21Z")

</div>

Hey all, I’m super new to all of this and literally still get tripped up on words like widget, pawn, asset and such… Please keep this in mind and know that I need answers in playground level, Barney style breakdown.

I’m using a prefabricated button from a pack (its a square) and making it into a rectangle. When I make it into a rectangle, it changes the “stretch” of the button, meaning, it looks like it is being stretched across the button. My question is, how do I go about making it look normal when I make it into a rectangle? Is there a way to do that in UE5 or is this yet another thing I have to learn how to do in another program? Any advise is greatly appreciated. Also, I will have tons of questions, and already do. If there are people on here I can DM for help for these things, that would be totally awesome…

Plus, you could literally make a “true” beginners guide that addresses all these things that are new to people not familiar at all with coding and how to put things together to make them work lol. I wish I had a printed book for that so I could reference, beginning to end, all aspects of creating a mobile RPG with explantions, in plain english, what each parameter and setting does. I digress…

---

<div class="post-metadata">

**Author:** ![rkennedyzz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rkennedyzz/32/734071_2.png) [@rkennedyzz](https://forums.unrealengine.com/u/rkennedyzz)\
**Post date:** [September 25, 2023, 9:15pm UTC](https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608/2 "2023-09-25T21:15:28Z")

</div>

Generally images used in widgets that are more detailed than just a colored shape will be raster images. AKA jpegs, pngs, tiffs etc. These cannot be stretched as it will just stretch the pixels. So you can either make a new asset externally in photoshop/gimp/art program of choice or use a simpler style that can be created using the in system shapes and colors. There are plugins to allow vector assets but then you would still have to find or make vector assets.

When making a UI generally assets are made at a specific shape and size and are not often stretched, if they are usually they have a tileable image or something similar.

---

<div class="post-metadata">

**Author:** ![Yellow5actual](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yellow5actual/32/755451_2.png) [@Yellow5actual](https://forums.unrealengine.com/u/Yellow5actual)\
**Post date:** [September 26, 2023, 1:52am UTC](https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608/3 "2023-09-26T01:52:22Z")

</div>

Ok, thanks for the advise. Doesn’t quite hit the nail on the head, though. So, I see in the pack that I bought, Premade widgets that use the same image file and it doesnt look stretched. When I don’t use the premade one, I, for some reason, cannot attain the same result with the same image file so I have to copy the widget in there and kind of modify it… poorly, i might add

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 26, 2023, 6:25am UTC](https://forums.unrealengine.com/t/widget-buttons-changing-shape/1311608/4 "2023-09-26T06:25:10Z")

</div>

Is this the effect you’re after:

> [@properly scale image as border in UMG](https://forums.unrealengine.com/t/properly-scale-image-as-border-in-umg/1268313/7):
>
> This looks fine. Are we talking about the border or the image that lives inside the border? [image] Here’s the behaviour I’d expect: From this image: [Untitled]

> Premade widgets that use the same image file and it doesnt look stretched.

It’s called [9-slice](https://en.wikipedia.org/wiki/9-slice_scaling) or [Box / Border](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/UMG/UserGuide/Styling/) mode.

* * *

More details:

> [@UI question](https://forums.unrealengine.com/t/ui-question/498637/2):
>
> You will find this feature referred to as 9-slice here and there. here is what happens when we try to make a border with the Image setting: Note how the edges and corners get distorted - they get squished! when Box is used, you get to reserve a percentage of the image (from each side) that will not be affected by stretching / squishing: The edges are preserved. That .25 margin = 25% of the image in pixels. This image is 540px wide, meaning that 135px (from the left & right edges) will …

How margins are calculated:

> [@9-slice scaling UMG image](https://forums.unrealengine.com/t/9-slice-scaling-umg-image/123231/4):
>
> The margins are percentage, as you said. For the image you posted, you’d have to keep margins at 0.4 or 0.35 - eyeballing it here, you may get away with 0.3 A margin 0.4 for an image 100x100 pixels would mean that when you stretch the image, only the 20 pixels in the middle will be stretched. The 40% from all sides will just stick to the edges. To get a good result, it’s always better to produce a base image that will never be scaled down, only up - basically make the smallest you will need an…
