Getting the initial text size of a RichEditBox. (answered)

I know it is affected by scaling and the like, but I'm not sure how to capture the initial value. this.Document.GetDefaultCharacterFormat().Size; is always 14.7f, no matter what I set the FontSize property too. getting this.Document.Selection.CharacterFormat.Size; in the constructor is also 14.7f. But when I actually select text, Selection.CharacterFormat.Size scales with FontSize/DpiScaling, making comparisons and toggling between two sizes extremely hard. I know I can programatically make a selection and get the initial value that way, but that might capture the bigger text size from a heading. I'm using WinUI 3 (There's no tag for it)
2 Replies
Sossenbinder
Sossenbinder4w ago
Super long shot, since this is not what I usually work with, but I did do Win32 c++ years ago. There used to be something like "GetTextExtent" which did something along these requirements Maybe something similar exists for winui
TheRainInSpainFalls
Thank you, they problem ended up with it the RichEditBox default value being stored before the control properly initialised. Capturing the font size in the _Loaded event works.
Want results from more Discord servers?
Add your server