Skip to content

[A11Y] Expose ClientSize property for forms #12183

Open

Description

@towebo

Environment

VisualStudio.17.Preview/17.11.0-pre.5.0+35118.90

.NET version

8.0

Did this work in a previous version of Visual Studio and/or previous .NET release?

No

Issue description

When you're blind or have very limited vision it's very hard to determine the suitable with for the form.
With the ClientSize property you can easily calculate a suitable width by adding the left and width for the right most control and adding the distance you've used for the left margin.

Steps to reproduce

  1. Create a new WinForms application and open the form.
  2. Add a textbox to the form and set it's Left and Top to 12 and its width to 200.
  3. Calculate the suitable form width by adding the textbox Left and Width and adding its Left once more: 12 + 200 + 12 = 224
  4. Set the form width to 224.

Not quite right.

Diagnostics

No response

Activity

  1. added
    untriaged
    on Sep 19, 2024
  2. added
    area-VSDesigner
    on Sep 24, 2024
  3. merriemcgaw commented on Oct 22, 2024

    @merriemcgaw
    Contributor

    @towebo - is your goal to be able to calculate everything in code, or to facilitate a design time experience for you? We may have other options to accomplish this, or we may be able to add something. The more we understand the specific use-case here the more we can help here.

  4. self-assigned this
    on Oct 22, 2024
  5. added
    waiting-author-feedback
    and removed
    untriaged
    on Oct 22, 2024
  6. towebo commented on Oct 24, 2024

    @towebo
    Author

    With the property ClientSize you can be sure that you get the space you want to the right of controls on the form when you design the form in the designer.
    Let's say you want to place controls 12 pixels in from the lefft side of the form and you'd like to have the same margin to the right. If you add 12 pixels (left spacing) + 150 pixels (control width) + 12 pixels (right spacing) = 174 pixels and set 174 as the form's width you won't get 12 pixel spacing to the right. This is because the form size include the border.

  7. added
    untriaged
    and removed
    waiting-author-feedback
    on Oct 24, 2024
  8. removed
    untriaged
    on Nov 1, 2024
  9. added this to the VS release milestone on May 6, 2025
  10. added theissue type on May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-VSDesigner

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions