Open lr-devx opened 5 months ago
HorizontalAlignment
isn't only used by RichEdit
, its used by many other controls.
This enumeration is used in numerous classes. A partial list of these classes is CheckedListBox, ColumnHeader, ComboBox, ControlPaint, Label, ListBox, Control, RichTextBox, and TextBox.
If we look at the underlying docs for win32: https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-paraformat2_1
So it is supported in win32 and exists in our interop code: https://github.com/dotnet/winforms/blob/aa582c48802a1ae97ee766cf9087fdc85f9bbd0e/src/System.Windows.Forms.Primitives/src/Interop/Richedit/Interop.PFA.cs#L6-L15
I think it might require an investigation into each consumer of HorizontalAlignment
and see if its supported on all the controls. If not, then a new enum would possibly be required.
(Whops) In that case it would make more sense to create a new enumeration, something like "TextAlignment" IMO
I'd suggest ParagraphAlignment
because it closely aligns with the docs.
@merriemcgaw this would be a breaking change. Is it unlikely to be accepted?
Yeah, I'm afraid if this is any sort of breaking change it would be unlikely to be accepted. Let's add the untriaged label and it can get discussed with the broader team, but I'd keep expectations somewhat lower.
@merriemcgaw What about adding a new property with the new enumeration and [Obsolete]
the old property?
@SteveAndrews we could create a second property to manage this, I don't know if we'd obsolete the original property though it sounds like we could make a non-breaking way to do this.
That said, I don't believe this will bubble up far enough priority-wise to make it to .NET 9. We can keep this on our radar for .NET 10 because properly done I can see how it would benefit richedit customers.
Background and motivation
I noticed that RTF documents support Justified alignment, yet RichTextBoxes do not provide the ability to set that alignment for some reasons.
API Proposal
API Usage
Alternative Designs
No response
Risks
None.
Will this feature affect UI controls?
It should be supported by the designer. It won't have any impact on accessibility. And obviously it doesn't need to be localized.