dotnet / winforms

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

TextAlign property doesn't work for ToolStripMenuItem #4985

Open John-Qiao opened 3 years ago

John-Qiao commented 3 years ago

More Info:

  1. This is not the regression issue, it occurs in .NET Framework project too.
  2. This issue occurs in the design time too.
  3. This issue occurs in MenuStrip/ContextMenuStrip/StatusStrip/ToolStrip controls.

Problem description:

TextAlign property doesn't work for File item. Actual

Expected behavior:

As set the TextAlign = MiddleRight for the File item in form designer, so the text of File item should shows on the right side. PropertySetting

Minimal repro:

  1. Open the attached TestApp.zip project in VS and run it.
  2. Click on toolStripMenuItem1 to expand its drop down item File.
  3. Observe the text align of File item.
dreddy-work commented 3 years ago

@John-Qiao , Is this issue in response to a feedback? We would need a business case to implement functionality. In the best case we may hide design time property. Did you check behavior in MFC (C++) app with 'MainMenu'?

John-Qiao commented 3 years ago

@dreddy-work yes, it's a feedback issue which post in here: https://developercommunity2.visualstudio.com/t/ToolStripMenuItem-TextAlign-doesnt-work/856122.

And I didn't find the TextAlign property for Menu items in MFC app, please check below screenshot: MFC-Main

RussKie commented 3 years ago

There is a solution available on SO https://stackoverflow.com/a/4397976/2338036, which also notes that "this is not standard Windows GUI menu item layout which users expect". Our goal is to allow building Windows native apps, and this request is asking to allow building apps that don't look native on Windows.

I propose we hide these API from the strip controls. Any users that desire to build apps with non-traditional Windows look and feel can provide custom renderers and achieve the desired.