Skip to content
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

ControlPaint.DrawBorder doesn't draw correctly #3945

Closed
JeremyKuhne opened this issue Sep 18, 2020 · 1 comment · Fixed by #3952 or #3956
Closed

ControlPaint.DrawBorder doesn't draw correctly #3945

JeremyKuhne opened this issue Sep 18, 2020 · 1 comment · Fixed by #3952 or #3956
Labels
💥 regression-preview Regression from a preview release

Comments

@JeremyKuhne
Copy link
Member

JeremyKuhne commented Sep 18, 2020

The ControlPaint.DrawBorder that takes individual side styles and colors doesn't render correctly:

            ControlPaint.DrawBorder(
                e.Graphics,
                bounds,
                Color.FromArgb(255, Color.Red), 1, ButtonBorderStyle.Solid,
                Color.FromArgb(255, Color.Green), 1, ButtonBorderStyle.Solid,
                Color.FromArgb(255, Color.Blue), 1, ButtonBorderStyle.Solid,
                Color.FromArgb(255, Color.Purple), 1, ButtonBorderStyle.Solid);
            bounds.Offset(0, 30);
            ControlPaint.DrawBorder(
                e.Graphics,
                bounds,
                Color.FromArgb(255, Color.Red), 1, ButtonBorderStyle.Dotted,
                Color.FromArgb(255, Color.Green), 1, ButtonBorderStyle.Dotted,
                Color.FromArgb(255, Color.Blue), 1, ButtonBorderStyle.Dotted,
                Color.FromArgb(255, Color.Purple), 1, ButtonBorderStyle.Dotted);
            bounds.Offset(0, 30);
            ControlPaint.DrawBorder(
                e.Graphics,
                bounds,
                Color.FromArgb(255, Color.Red), 1, ButtonBorderStyle.Dashed,
                Color.FromArgb(255, Color.Green), 1, ButtonBorderStyle.Dashed,
                Color.FromArgb(255, Color.Blue), 1, ButtonBorderStyle.Dashed,
                Color.FromArgb(255, Color.Purple), 1, ButtonBorderStyle.Dashed);
            bounds.Offset(0, 30);
            ControlPaint.DrawBorder(
                e.Graphics,
                bounds,
                Color.FromArgb(255, Color.Red), 1, ButtonBorderStyle.Outset,
                Color.FromArgb(255, Color.Green), 1, ButtonBorderStyle.Outset,
                Color.FromArgb(255, Color.Blue), 1, ButtonBorderStyle.Outset,
                Color.FromArgb(255, Color.Purple), 1, ButtonBorderStyle.Outset);
            bounds.Offset(0, 30);
            ControlPaint.DrawBorder(
                e.Graphics,
                bounds,
                Color.FromArgb(255, Color.Red), 1, ButtonBorderStyle.Inset,
                Color.FromArgb(255, Color.Green), 1, ButtonBorderStyle.Inset,
                Color.FromArgb(255, Color.Blue), 1, ButtonBorderStyle.Inset,
                Color.FromArgb(255, Color.Purple), 1, ButtonBorderStyle.Inset);

Normal is on the left, current is on the right:

image

Dotted and dashed are ok, the others are missing the lower right pixel. This is an artifact of GDI not ending on the same pixel as GDI+. This is more obvious when widths are greater than 1:

image

@JeremyKuhne JeremyKuhne added this to the 5.0 RC2 milestone Sep 18, 2020
@RussKie RussKie added 💥 regression-preview Regression from a preview release Priority:1 Work that is critical for the release, but we could probably ship without labels Sep 18, 2020
JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this issue Sep 18, 2020
Fixes dotnet#3945

The DrawBorder overload that takes individual side parameters needed to adjust line ends when drawing in GDI.

Manually validated output at different widths and transparencies between 3.1 and 5.0. Will follow up with automated regression tests in a separate PR.
@ghost ghost added the 🚧 work in progress Work that is current in progress label Sep 18, 2020
JeremyKuhne added a commit that referenced this issue Sep 19, 2020
Fixes #3945

The DrawBorder overload that takes individual side parameters needed to adjust line ends when drawing in GDI.

Manually validated output at different widths and transparencies between 3.1 and 5.0. Will follow up with automated regression tests in a separate PR.
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Sep 19, 2020
JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this issue Sep 19, 2020
Fixes dotnet#3945

The DrawBorder overload that takes individual side parameters needed to adjust line ends when drawing in GDI.

Manually validated output at different widths and transparencies between 3.1 and 5.0. Will follow up with automated regression tests in a separate PR.
@RussKie RussKie reopened this Sep 21, 2020
@ghost ghost added the 🚧 work in progress Work that is current in progress label Sep 21, 2020
@RussKie RussKie linked a pull request Sep 21, 2020 that will close this issue
JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this issue Sep 21, 2020
…or the end point of lines that were switched from GDI+ to GDI (for performance and memory usage). Note that the majority of the code in these commits are test code.

Fixes dotnet#3953
Fixes dotnet#3945
Fixes dotnet#3931
Fixes dotnet#3944
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Sep 23, 2020
@RussKie RussKie removed the Priority:1 Work that is critical for the release, but we could probably ship without label Sep 24, 2020
@RussKie RussKie removed this from the 5.0 RC2 milestone Sep 24, 2020
@RussKie RussKie closed this as completed Sep 24, 2020
@Marie-Shi
Copy link

Verified this issue with 5.0.100-rc.2.20477.2 from 5.0 RC2 branch, it is fixed. Now ControlPaint.DrawBorder can draw correctly, the lower right pixel is fine.
2

@dotnet dotnet locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💥 regression-preview Regression from a preview release
Projects
None yet
3 participants