From b17ebb2ec4a04e6ecc4c270b9ca5d6594984cd63 Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Fri, 30 Jun 2017 12:35:52 +0200
Subject: [PATCH] [KOE-125] Fixed selection of separator borders in drop list
---
.../AcaciaZPushPlugin/UI/GABLookupControl.cs | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/UI/GABLookupControl.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/UI/GABLookupControl.cs
index 2eb4053..7c32a6b 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/UI/GABLookupControl.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/UI/GABLookupControl.cs
@@ -249,7 +249,24 @@ namespace Acacia.UI
GABUser item = (GABUser)e.Item;
// Draw the background
- e.DrawBackground();
+ if (e.State == DrawItemState.Selected)
+ {
+ // If the item is selected, we don't want the separating border to get selected too.
+ // So draw the normal background in the border area
+ Rectangle rect = e.Bounds;
+ rect.Y = rect.Bottom - BorderPadding.Vertical - BorderThickness;
+ rect.Height = BorderPadding.Vertical + BorderThickness;
+ new System.Windows.Forms.DrawItemEventArgs(e.Graphics, e.Font, rect, e.Index, DrawItemState.None).DrawBackground();
+
+ // And the selected background in the item area.
+ rect.Y = e.Bounds.Y;
+ rect.Height = e.Bounds.Height - BorderPadding.Vertical - BorderThickness;
+ new System.Windows.Forms.DrawItemEventArgs(e.Graphics, e.Font, rect, e.Index, DrawItemState.Selected).DrawBackground();
+ }
+ else
+ {
+ e.DrawBackground();
+ }
// Get the sizes
Size nameSize = TextRenderer.MeasureText(e.Graphics, item.FullName, Font);