From 9e94d116a742370d30cc2d85db0eb94215148646 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Mon, 1 Jan 2018 11:32:59 -0800 Subject: [PATCH] Discover and use first opaque background - Issue MatterHackers/MCCentral#2546 Overflow menu button should have fully opaque color --- .../View3D/PrinterBar/OverflowBar.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs index bf38218e3..96576409e 100644 --- a/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs +++ b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs @@ -27,8 +27,11 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +using System; +using System.Linq; using MatterHackers.Agg; using MatterHackers.Agg.Platform; +using MatterHackers.Agg.UI; namespace MatterHackers.MatterControl.PartPreviewWindow { @@ -49,13 +52,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public OverflowMenu OverflowMenu { get; } - //// On parent changes walk back to the first ancestor with background colors and copy - //public override void OnParentChanged(EventArgs e) - //{ - // var firstBackgroundColor = this.Parents().Where(p => p.BackgroundColor != Color.Transparent).FirstOrDefault()?.BackgroundColor; - // this.OverflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent; + // On load walk back to the first ancestor with background colors and copy + public override void OnLoad(EventArgs args) + { + var firstBackgroundColor = this.Parents().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor; + this.OverflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent; - // base.OnParentChanged(e); - //} + base.OnLoad(args); + } } } \ No newline at end of file