Skip to content

Incorrect toolbar location at 125%+ scale factor #4446

@RussKie

Description

@RussKie

Presumably all versions:

  • .NET Framework: 4.6.1 (tested)
  • .NET Version: 5.0 (tested)

Problem description:

Originally reported in gitextensions/gitextensions#8680.

An application with two toolbars placed on the same lane, one after another. When the app is run in scaled environments (i.e. 125%+) the toolbars will get re-odered if the first toolbar becomes longer than the location of the second toolbar.

The same problem isn't observed at 100% scale factor, or if the repro app doesn't use its app.manifest.

  • Designer:
    image

  • Runtime 100%
    image

  • Runtime 150%
    image

Expected behavior:

The order of the toolbars set at the design time must be preserved.

A workaround is to remove all toolbars after InitializeComponent(); and add them back in the correct order, e.g.:

        public FormBrowse()
        {
            InitializeComponent();

            this.toolPanel.TopToolStripPanel.Controls.Clear();
            this.toolPanel.TopToolStripPanel.Controls.Add(this.ToolStripFilters);
            this.toolPanel.TopToolStripPanel.Controls.Add(this.ToolStripMain);

        }

Minimal repro:

  1. clone https://github.com/RussKie/Test-ToolStripOrder
  2. run the app at 100% - observe ToolStripMain before ToolStripFilters
  3. run the app at 150%+ - observe the reverse order of toolbars

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 bugProduct bug (most likely)area-HDPI-SAIssues related to high DPI SystemAware modearea-controls-StripControlstenet-compatibilityIncompatibility with previous versions or with WinForms for .NET Framework

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions