dotnet / dotnet/winforms

Make appearance of MenuStrip & ContextMenuStrip look native when RenderMode = System

Open
#2,543 32 comments 14 reactions 0 assignees View on GitHub
:beetle: bug area-controls-StripControls area-Theming tenet-compatibility tenet-compatibility-OS
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

(split off from #2476)

### Windows 7

See #2476 for screenshots if needed.

### Windows 10

| Native | Strip (RenderMode = System) |
| --- | --- |
| ![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) |
| ![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) |
| ![a](https://user-images.githubusercontent.com/3685160/71302072-76ed5f80-23a7-11ea-9ae8-6e962c33e02d.png) | ![b](https://user-images.githubusercontent.com/3685160/71302073-7ce34080-23a7-11ea-9ddf-e9d30cda74aa.png) |
| ![bb](https://user-images.githubusercontent.com/3685160/71302431-24ae3d80-23ab-11ea-9291-d15d91426084.png) | ![aa](https://user-images.githubusercontent.com/3685160/71302436-2b3cb500-23ab-11ea-92ba-e588d7e69c72.png) |

### List of Differences

It's probably not worth matching the look of Windows 7, so I will only consider differences from the Windows 10 look.

I have done measurements on 100% and 150% DPI, and marked those that change. I have not measured widths/heights of items, those seem mostly fine.

- **Main Menu**
- [ ] Menu height should be (19px * DPI)
- [ ] Make menu items flush with the left and top side of the window (no padding/border between them)
- [ ] The menu background from top to bottom is (19px * DPI - 1px) of RGB(255, 255, 255), and then 1px bottom border of RGB(242, 242, 242)
- Note that item highlight overlays the bottom border and the top of sub-menus is just below the bottom border
- [ ] Set highlighted item background to RGB(204, 232, 255)
- [ ] Set highlighted item border to 1px of RGB(153, 209, 255)
- [ ] Do not invert text color of highlighted items
- [ ] Reduce left/right padding of menu items (appears to be 1px for border + (6px * DPI) of padding)
- **Context Menu & Main Menu sub-menus**
- [ ] Set border color to RGB(204, 204, 204)
- [ ] Set overall background color to RGB(242, 242, 242), so that non-highlighted items and padding between items and border is this color
- [ ] Set checkmark/image column background color to RGB(240, 240, 240)
- [ ] Set highlighted item background color to RGB(144, 200, 246)
- [ ] Fix the weird white line on the left of highlighted items
- [ ] Do not invert text color of highlighted items
- [ ] Increase padding between the items and border (1px -> 2px)
- [ ] Update icon of arrow on items with sub-menus and move it up by 1 px to center it
- [ ] Make splitter 1px tall
- [ ] Set splitter color to RGB(215, 215, 215)
- [ ] Fix splitter padding (it should not leak into the checkmark/image column, and be 2px from the right border)
- [ ] Set checkmark color to RGB(51, 51, 51)
- [ ] Checkmark should have a background color RGB(144, 200, 246) when checked, or RGB(86, 176, 250) when checked and highlighted at the same time
- [ ] Sub-menus should overlap their parent menu item by 6 pixels on the left, and be flush with the top
- [ ] After highlighting an item with a sub-menu and then moving cursor to a sibling item above/below, the original highlighted item should immediately become unhighlighted
- Currently the highlight lingers until the sub-menu disappears (see last screenshot)

It's a lot ^.^ but it should make them almost completely visually indistinguishable from native controls.

### (Updated) Test Project

[winforms.zip](https://github.com/dotnet/winforms/files/3990977/winforms.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.