# How can i get nice unstreatched borders in UMG

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-nice-unstreatched-borders-in-umg/1261331>\
**Category:** UI\
**Tags:** unreal-engine, question, UMG\
**Created:** [August 15, 2023, 2:15am UTC](https://forums.unrealengine.com/t/how-can-i-get-nice-unstreatched-borders-in-umg/1261331 "2023-08-15T02:15:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [August 15, 2023, 7:57am UTC](https://forums.unrealengine.com/t/how-can-i-get-nice-unstreatched-borders-in-umg/1261331/3 "2023-08-15T07:57:02Z")

</div>

> [@woodencase01](#):
>
> How can I achieve this?

9-Slice. Scroll down to` Setting Image States`:

> **[UMG Styling in Unreal Engine | Unreal Engine 5.7 Documentation | Epic...](https://dev.epicgames.com/documentation/en-us/unreal-engine/styling?application_version=4.27)**
>
> A guide to stylizing Widget Blueprints in UMG in Unreal Engine.

Example:

> [@Creating a material instance for each button all good?](https://forums.unrealengine.com/t/creating-a-material-instance-for-each-button-all-good/476815/2):
>
> (Otherwise the rounded corners aren’t ‘round’ but more oblong). Look into how [9-slice](https://en.wikipedia.org/wiki/9-slice_scaling) works (called 9 Scale Box in UE4) - Setting Image States, here: The margins control how much of the edges are preserved. If all you want is rounded boxes on differently shaped buttons, 1 material instance is enough for this.

* * *

> The material is drawn as a box with margins set to zero. However, no matter how I’m configuring the margin and the draw-as, I can’t get it to look good on smaller buttons:

Can you show how it’s set up, and what are the sizes we’re talking about? The thing is that 9-slice only works _up_, you want to design the smallest possible UI elements first, and only then stretch them, preserving edges / corners intact.

* * *

Material responds to Image Size, it might be as straightforward as reducing its size on the `ButtonMaterial`. Then margins work like percentage in the 0-1 range, counting from each edge.

- size set to 32 (smaller or equal to the px size of this element):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/8/e68d2dbb751d2bc1344a3aa78daf1a862e466fdf.png)

- and size being too large for this element:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/c/7bc91ac175e17e078495ac29f77b5656661fe9fb.png)

This confused the margin as it now counts 40% of the 128 in pixels.

---

_[View the full topic](https://forums.unrealengine.com/t/how-can-i-get-nice-unstreatched-borders-in-umg/1261331)._
