Skip to content

Documentation Incorrect #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
HeinzKessler opened this issue Apr 29, 2018 — with docs.microsoft.com · 5 comments
Open

Documentation Incorrect #761

HeinzKessler opened this issue Apr 29, 2018 — with docs.microsoft.com · 5 comments
Labels
area-WinForms Issues or PRs that relate to WinForms. doc-update Update outdated articles Pri2 Indicates issues/PRs that are medium priority unspecified/svc
Milestone

Comments

Copy link

The statement under "Remarks" is not correct: If the values for Top, Bottom, Left, or Rights were set separately, then All returns -1, even if all 4 properties have the same value:
var p = new Padding( 5 );
// Here, All returns 5
p.Left = 5;
// Now, All returns -1, although all 4 properties still have a value of 5
p.All = 5;
// Now, All returns 5 again

see also: https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Padding.cs,6c9dc153b2c496ae


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@pkulikov
Copy link
Contributor

pkulikov commented Apr 29, 2018

I wonder if it's a bug in documentation or implementation?
Setter of the Left property:

if (_all || _left != value) {
    _all = false;
    _left = value;
}

can be improved like this, for example:

if (_left == value) return;
_left = value;
_all = _top == _left && _top == _right && _top == _bottom;

@HeinzKessler
Copy link
Author

That's right: The implementation is wrong, but I don't think that they will change it, because thats would break people's existing code.

@mairaw
Copy link
Contributor

mairaw commented Apr 30, 2018

@Tanya-Solyanik can you comment on this one? There's an indication that this is a product bug, but let me know if you'd like to just document the behavior as-is.

@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented May 1, 2018

This might be a product bug, but, like HeinzKessler said, it would be a breaking change to fix this and the workaround is simple. As is 'Padding.Allgetter indicates that padding values were set using thePadding.All` setting. this information might be useful. @mairaw - could you please document that?

@pkulikov
Copy link
Contributor

pkulikov commented May 1, 2018

As is Padding.All getter indicates that padding values were set using the Padding.All setting.

Or during construction. Both by the one-parameter constructor and by the four-parameter constructor if it gets all four the same values: Padding.All property is also defined (as I read it from the code).

@BillWagner BillWagner transferred this issue from dotnet/docs Nov 20, 2018
@dotnet-bot dotnet-bot added area-WinForms Issues or PRs that relate to WinForms. untriaged New issue has not been triaged by the area owner and removed rerun-labels labels Nov 20, 2018
@mairaw mairaw added Pri2 Indicates issues/PRs that are medium priority doc-update Update outdated articles and removed untriaged New issue has not been triaged by the area owner labels Nov 26, 2018
@mairaw mairaw added this to the Backlog milestone Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-WinForms Issues or PRs that relate to WinForms. doc-update Update outdated articles Pri2 Indicates issues/PRs that are medium priority unspecified/svc
Projects
None yet
Development

No branches or pull requests

7 participants