dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.35k stars 965 forks source link

The ToolStripMenuItem has extra numbers and the other items do not have selection borders on ContextMenuStrip control in DemoConsole application #11700

Open MelonWang1 opened 1 month ago

MelonWang1 commented 1 month ago

.NET version

.NET 9.0 main branch of WinForms repo

Did it work in .NET Framework?

Not tested/verified

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

No, this issue also repro in release/9.0-preview3 branch of WinForms repo. Maybe releate PR 10979.

Issue description

Current Behavior : In DemoConsole test app of WinForms repo, the name and text property of ToolStripMenuItem has extra numbers. Except for ToolStripMenuItem, ToolStripComboBox, ToolStripTextBox and ToolStripSeparator do not have selection borders.

https://github.com/user-attachments/assets/639dea54-f1bd-418d-8d4f-b29b4eec364e

Expected Behavior: No extra numbers of ToolStripMenuItem. And ToolStripComboBox, ToolStripTextBox, ToolStripSeparator should have selection border.

https://github.com/user-attachments/assets/6ccdcbda-08e4-40a3-a45f-e044fdd7759c

Steps to reproduce

Test sample: DemoConsole in Winforms repo

  1. Select ContextMenuStrip control.
  2. Input 'test' to Type Here, press 'Enter' key.
  3. Select 'test' ToolStripMenuItem.
  4. Add a ToolStripMenuItem using dropdown item.
  5. Add ToolStripComboBox, ToolStripTextBox, ToolStripSeparator.
SimonZhao888 commented 1 month ago

PR 11732 only fixes the misnaming issue, it doesn't fix the issue where ToolStripTextBox gets the focus and then triggers a refresh of the entire control causing it to lose focus.

Zheng-Li01 commented 1 month ago

Verified the issue on feature/10.0 branch of dotnet/winforms repo that the " extra numbers" issue of ToolStripMenuItem has been fixed, but the issue where ToolStripTextBox gets the focus and then triggers a refresh of the entire control causing it to lose focus still exist. gh11700

Tanya-Solyanik commented 2 weeks ago

@Zheng-Li01 please retest this part

but the issue where ToolStripTextBox gets the focus and then triggers a refresh of the entire control causing it to lose focus still exist.

on the latest main with this PR - https://github.com/dotnet/winforms/issues/11909

Zheng-Li01 commented 2 weeks ago

In the latest main branch, have the issue https://github.com/dotnet/winforms/issues/11862 when clicking the smarttag, and will verified this issue after the https://github.com/dotnet/winforms/issues/11862 was resolved.

Tanya-Solyanik commented 2 weeks ago

Thanks, @Zheng-Li01 !

Zheng-Li01 commented 5 days ago

@Zheng-Li01 please retest this part

but the issue where ToolStripTextBox gets the focus and then triggers a refresh of the entire control causing it to lose focus still exist.

on the latest main with this PR - #11909

Verified the issue with latest main branch of dotnet/winforms repo, this part issue still reproduce.

GH11700

LeafShi1 commented 5 days ago

Call stack for "ToolStripTextBox cannot get focus" issue

System.Windows.Forms.Design.dll!System.ComponentModel.Design.SelectionService.System.ComponentModel.Design.ISelectionService.SetSelectedComponents(System.Collections.ICollection components, System.ComponentModel.Design.SelectionTypes selectionType) Line 408   C#
    System.Windows.Forms.Design.dll!System.Windows.Forms.Design.ToolStripItemBehavior.OnMouseDown(System.Windows.Forms.Design.Behavior.Glyph g, System.Windows.Forms.MouseButtons button, System.Drawing.Point mouseLoc) Line 428   C#
    System.Windows.Forms.Design.dll!System.Windows.Forms.Design.Behavior.BehaviorService.OnMouseDown(System.Windows.Forms.MouseButtons button, System.Drawing.Point mouseLoc) Line 670  C#
    System.Windows.Forms.Design.dll!System.Windows.Forms.Design.Behavior.BehaviorService.AdornerWindow.WndProcProxy(ref System.Windows.Forms.Message m, int x, int y) Line 350  C#
    System.Windows.Forms.Design.dll!System.Windows.Forms.Design.Behavior.BehaviorService.AdornerWindow.MouseHook.ProcessMouseMessage(Windows.Win32.Foundation.HWND hwnd, Windows.Win32.MessageId msg, int x, int y) Line 196    C#
    System.Windows.Forms.Design.dll!System.Windows.Forms.Design.Behavior.BehaviorService.AdornerWindow.MouseHook.MouseHookProc(int nCode, Windows.Win32.Foundation.WPARAM wparam, Windows.Win32.Foundation.LPARAM lparam) Line 99   C#