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

Add switch "MoveTreeViewTextLocationOnePixel" for update the drawing position of the Treeview node #44403

Open
1 of 3 tasks
LeafShi1 opened this issue Jan 16, 2025 · 0 comments
Assignees
Labels
breaking-change Indicates a .NET Core breaking change doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged

Comments

@LeafShi1
Copy link
Member

LeafShi1 commented Jan 16, 2025

Description

The TreeNode in the TreeView control allows users to customize DrawMode and add checkboxes. However, under certain conditions (CheckBoxes=true,DrawMode=OwnerDrawText, In OnDrawNode event set DrawDefault=true), the checkbox image will be truncated due to the position of the TreeNode text drawing. To avoid affecting normal common use, an AppContext switch setting is added here to solve the problem of checkbox truncation in certain situations.

Version

.NET 10 Preview 1

Previous behavior

TreeView control with CheckBoxes=true, DrawMode=OwnerDrawText, and set DrawDefault=true in OnDrawNode event
the TreeNode CheckBox images are shown truncated on the right border.

New behavior

Set switch "System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true in project's runtime config file and then when TreeView with CheckBoxes=true, DrawMode=OwnerDrawText, and set DrawDefault=true in OnDrawNode event, the TreeNode'checkboxes can be shown completed

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

This change ensures that the checkbox of the node in the TreeView control can be fully displayed.

Recommended action

Users need to manually add "System.Windows.Forms.TreeView.MoveTreeViewTextLocationOnePixel": true to their project's runtimeconfig.json file to turn on the switch.

Feature area

Windows Forms

Affected APIs

https://learn.microsoft.com/dotnet/api/system.windows.forms.treeview.checkboxes

@LeafShi1 LeafShi1 added breaking-change Indicates a .NET Core breaking change doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 labels Jan 16, 2025
@dotnet-policy-service dotnet-policy-service bot added the ⌚ Not Triaged Not triaged label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

2 participants