dotnet / dotnet/winforms

Make MenuStrip and ContextMenuStrip look more Windows-native

Open
#2,476 10 comments 15 reactions 0 assignees View on GitHub
:beetle: bug area-Theming tenet-compatibility tenet-compatibility-OS
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

* .NET Core Version: 3.0
* Have you experienced this same bug with .NET Framework?: Yes

With the removal of MainMenu and ContextMenu native wrappers in .NET Core 3.1, and no alternative for native controls, it'd be a good idea to make the replacement strip controls look and feel more native.

Including screenshots from Windows 10 and 7, and `RenderMode` set to `ManagedRenderMode` and `System` to point out differences.

### Windows 10

| Native | Strip (System) | Strip (Managed) |
| --- | --- | --- |
| ![NativeMenu10](https://user-images.githubusercontent.com/3685160/70310185-5a7dee80-180f-11ea-9ae7-f970c6b69bbe.png) | ![StripSystemMenu10](https://user-images.githubusercontent.com/3685160/70310193-5eaa0c00-180f-11ea-9f91-48f14507a707.png) | ![StripManagedMenu10](https://user-images.githubusercontent.com/3685160/70310205-62d62980-180f-11ea-8287-d57b158a70ad.png) |
| ![NativeContext10](https://user-images.githubusercontent.com/3685160/70308793-57353380-180c-11ea-8005-d8035212a269.png) | ![StripSystemContext10](https://user-images.githubusercontent.com/3685160/70308811-5f8d6e80-180c-11ea-9296-dc97f56403c3.png) | ![StripManagedContext10](https://user-images.githubusercontent.com/3685160/70308817-63b98c00-180c-11ea-8bb6-9117a3a5b904.png) |

### Windows 7

| Native | Strip (System) | Strip (Managed) |
| --- | --- | --- |
| ![NativeMenu7](https://user-images.githubusercontent.com/3685160/70310228-6bc6fb00-180f-11ea-84dc-c3594e5d69e3.png) | ![StripSystemMenu7](https://user-images.githubusercontent.com/3685160/70310240-6ff31880-180f-11ea-8558-95912eca1c51.png) | ![StripManagedMenu7](https://user-images.githubusercontent.com/3685160/70310245-73869f80-180f-11ea-9935-ec029d6a8ec0.png) |
| ![NativeContext7](https://user-images.githubusercontent.com/3685160/70308960-b72bda00-180c-11ea-898f-c5969f4463b4.png) | ![StripSystemContext7](https://user-images.githubusercontent.com/3685160/70308967-bd21bb00-180c-11ea-81c8-d27a9e2a8951.png) | ![StripManagedContext7](https://user-images.githubusercontent.com/3685160/70308982-c27f0580-180c-11ea-8f77-21240bad585c.png) |

### Additional Information

The visual differences should be obvious, but there are a few usability differences as well:

* In `RenderMode = System`, the hover highlight over a menu item with subitems - after the subitem menu becomes visible - lingers
* In the native menu, clicking on a menu item when the window is unfocused immediately activates that item; MenuStrip requires a second click
* In the native menu, pressing left arrow key when the first menu item is highlighted brings out the "right-click on window title bar" menu as if it was another menu item:
![image](https://user-images.githubusercontent.com/3685160/70310763-b432e880-1810-11ea-98f5-f6072ad1f510.png)
* The native menu does not take up any space in `Form.ClientHeight`; when migrating to a `MenuStrip`, you will lose 20 pixels of height
* There is a positioning difference between the native and strip context menu when invoked by a dedicated context menu key instead of a mouse
* Possibly more, this is just what I noticed after a few minutes of testing

### Test Project

The test project targets .NET Core 3.0, and opens 3 windows (native + the 2 strip variations).

[WindowsFormsStripControlsCore.zip](https://github.com/dotnet/winforms/files/3931357/WindowsFormsStripControlsCore.zip)

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.