From 5354063129471250be58840adfeb65e279711693 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 19 Aug 2023 10:43:04 -0500 Subject: [PATCH] Add simple way to remove button border. --- Source/Engine/UI/GUI/Common/Button.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/Button.cs b/Source/Engine/UI/GUI/Common/Button.cs index 8ab6366eb..88ee0437e 100644 --- a/Source/Engine/UI/GUI/Common/Button.cs +++ b/Source/Engine/UI/GUI/Common/Button.cs @@ -80,21 +80,27 @@ namespace FlaxEngine.GUI public Color BackgroundColorSelected { get; set; } /// - /// Gets or sets the color of the border. + /// Gets or sets whether the button has a border. /// [EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups] + public bool HasBorder { get; set; } = true; + + /// + /// Gets or sets the color of the border. + /// + [EditorDisplay("Border Style"), EditorOrder(2011), ExpandGroups] public Color BorderColor { get; set; } /// /// Gets or sets the border color when button is highlighted. /// - [EditorDisplay("Border Style"), EditorOrder(2011)] + [EditorDisplay("Border Style"), EditorOrder(2012)] public Color BorderColorHighlighted { get; set; } /// /// Gets or sets the border color when button is selected. /// - [EditorDisplay("Border Style"), EditorOrder(2012)] + [EditorDisplay("Border Style"), EditorOrder(2013)] public Color BorderColorSelected { get; set; } /// @@ -245,7 +251,8 @@ namespace FlaxEngine.GUI BackgroundBrush.Draw(clientRect, backgroundColor); else Render2D.FillRectangle(clientRect, backgroundColor); - Render2D.DrawRectangle(clientRect, borderColor); + if (HasBorder) + Render2D.DrawRectangle(clientRect, borderColor); // Draw text Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center);