dotnet / dotnet/winforms

Anchoring a Control at a UserControl

Open
#3,007 14 comments 0 reactions 0 assignees View on GitHub
:beetle: bug :boom: regression-release area-Anchor/Scaling area-DesignerSupport
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

* .NET Core Version:
.NET Core SDK (gemäß "global.json"):
Version: 3.1.200
Commit: c5123d973b

Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.200\

Host (useful for support):
Version: 3.1.2
Commit: 916b5cba26

* Have you experienced this same bug with .NET Framework?:
No

**Problem description:**

I place a ListView (or other Controls like a Panel) to a UserControl with the same Size 250, 200. Margins of the ListView are set to Zero. Anchor of ListView is set to Left, Top, Right and Bottom.
The UserControl is placed on a Form. When the Form is shown, the UserControl sized correctly to a Size of 292, 231 by the Segui Font, but the ListView have a Size 249, 199


**Expected behavior:**

The ListView should anchor correctly to a Size like the UserControl.

**Minimal repro:**

See project TestControls. I have colorized the BackColor of UserControl and ListView different.
[TestControls.zip](https://github.com/dotnet/winforms/files/4368973/TestControls.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.