Skip to content

Commit 4a93ae2

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

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ private static void DrawButtonBorder(Graphics graphics, Rectangle bounds, PushBu
142142
if (state == PushButtonState.Pressed)
143143
{
144144
// In pressed state, invert the 3D effect: highlight bottom/right, shadow top/left
145-
topLeftOuter = DefaultColors.ShadowColor; // shadow
145+
topLeftOuter = DefaultColors.HighlightColor; // shadow
146146
bottomRightOuter = DefaultColors.HighlightColor; // highlight
147-
topLeftInner = DefaultColors.ShadowDarkColor; // deeper shadow
147+
topLeftInner = DefaultColors.HighlightBrightColor; // deeper shadow
148148
bottomRightInner = DefaultColors.HighlightBrightColor; // brighter highlight
149149
}
150150
else if (state == PushButtonState.Disabled)
@@ -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 pressed/hot state, invert the 3D effect: highlight bottom/right, shadow top/left
161+
topLeftOuter = DefaultColors.ShadowColor; // shadow
162+
bottomRightOuter = DefaultColors.HighlightColor; // highlight
163+
topLeftInner = DefaultColors.ShadowDarkColor; // deeper shadow
164+
bottomRightInner = DefaultColors.HighlightBrightColor; // brighter 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)