dotnet / dotnet/winforms

While EnableVisualStyles is false, MonthCalendar HitTest() does not return a valid HitTestInfo when clicking anywhere on the control.

Open
#14,095 2 comments 0 reactions 0 assignees View on GitHub
area-HDPI untriaged
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### .NET version

Tested in current versions: .NET8, .NET9 and .NET10, and the issue exists in all versions.

### Did it work in .NET Framework?

Yes

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

Issue exists in older versions (.NET5) as well.

### Issue description

While EnableVisualStyles is set to false, MonthCalendar HitTest() does not return a valid HitTestInfo when clicking any of the valid areas on the control. It always returns a HitArea of Nowhere. This exact scenario works fine in .NET Framework, and it works correctly if EnableVisualStyles is true.

### Steps to reproduce

[IsolatedSample.zip](https://github.com/user-attachments/files/23865144/IsolatedSample.zip)

Steps:
1. Run the attached sample.
2. Click anywhere on the MonthCalendar.

Results:
The listbox shows displays the Point and HitArea which is always "Nowhere"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.