Skip to content

Setting SplitContainer.Panel2MinSize incorrectly changes SplitterDistance #3568

Description

@zwergenaufstand
  • .NET Core Version:
    3.1.301

  • Have you experienced this same bug with .NET Framework?:
    Yes

Problem description:
Changing Panel2MinSize in a horizontally oriented SplitContainer (Panel2 below Panel1) changes the SplitterDistance if Panel2MinSize > Panel2.Width.

Expected behavior:
SplitContainer should respect its Orientation when changing Panel2MinSize. Changing Panel2MinSize in a horizontally oriented SplitContainer (Panel2 below Panel1) should only change the SplitterDistance if Panel2MinSize > Panel2.Height.

Minimal repro:

var form = new Form() { Size = new Size(200, 500) };
var splitContainer = new SplitContainer() { Orientation = Orientation.Horizontal };
splitContainer.Dock = DockStyle.Fill;
form.Controls.Add(splitContainer);
form.Show();

Debug.WriteLine(splitContainer.Panel2MinSize); // 25
Debug.WriteLine(splitContainer.Panel2.Height); // 227
Debug.WriteLine(splitContainer.SplitterDistance); // 230

splitContainer.Panel2MinSize = 205;

Debug.WriteLine(splitContainer.Panel2MinSize); // 205
Debug.WriteLine(splitContainer.Panel2.Height); // 269 (should be 227)
Debug.WriteLine(splitContainer.SplitterDistance); // 188 (should be 230)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 bugProduct bug (most likely)🚧 work in progressWork that is current in progresshelp wantedGood issue for external contributors

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions