Skip to content

Commit c67a19b

Browse files
Leaf ShiLeaf Shi
authored andcommitted
Add hover visual effect for Popup button
1 parent f812cb6 commit c67a19b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/DarkMode/PopupButtonDarkModeRenderer.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ private static void DrawButtonBorder(Graphics graphics, Rectangle bounds, PushBu
141141

142142
if (state == PushButtonState.Pressed)
143143
{
144-
// In pressed state, invert the 3D effect: highlight bottom/right, shadow top/left
145-
topLeftOuter = DefaultColors.ShadowColor; // shadow
146-
bottomRightOuter = DefaultColors.HighlightColor; // highlight
144+
// In pressed state, invert the 3D effect: brighter highlight bottom/right, deeper shadow top/left
145+
topLeftOuter = DefaultColors.ShadowDarkColor; // deeper shadow
146+
bottomRightOuter = DefaultColors.HighlightBrightColor; // brighter highlight
147147
topLeftInner = DefaultColors.ShadowDarkColor; // deeper shadow
148148
bottomRightInner = DefaultColors.HighlightBrightColor; // brighter highlight
149149
}
@@ -155,9 +155,17 @@ private static void DrawButtonBorder(Graphics graphics, Rectangle bounds, PushBu
155155
topLeftInner = DefaultColors.DisabledBorderMidColor;
156156
bottomRightInner = DefaultColors.DisabledBorderMidColor;
157157
}
158+
else if (state == PushButtonState.Hot)
159+
{
160+
// In hover state, invert the 3D effect: highlight bottom/right, shadow top/left
161+
topLeftOuter = DefaultColors.ShadowColor; // shadow
162+
bottomRightOuter = DefaultColors.HighlightColor; // highlight
163+
topLeftInner = DefaultColors.ShadowColor; // shadow
164+
bottomRightInner = DefaultColors.HighlightColor; // highlight
165+
}
158166
else
159167
{
160-
// Normal/hot: highlight top/left, shadow bottom/right
168+
// Normal: highlight top/left, shadow bottom/right
161169
topLeftOuter = DefaultColors.HighlightColor; // highlight
162170
bottomRightOuter = DefaultColors.ShadowColor; // shadow
163171
topLeftInner = DefaultColors.HighlightBrightColor; // brighter highlight

0 commit comments

Comments
 (0)