Hi Team,
I am using UltraWinTree and facing following issue.
I am using UltraFormattedTextEditor in the UltraWinTree as I need to format the tree node text. But while editing the tree node, the text is getting truncated at the end. Please refer below screenshot. The font I need to use is Tahoma with font size 10.
Can you please help me in this.
Thanks
- Kaustubh
Hello Kaustubh,
Could you let me know if you are overriding the setting of the ultratree? And if you do, could you share which properties are you overriding?
The reason why I am asking is that I have tested this on a small sample and when I enter a text that is too long, on my side a scrollbar appear automatically, without having to change any properties and using only the default ones.
Regarding using the UltraFormattedTextEditor, if you need it only for applying the “Tahoma” font style and font size of 10, it shouldn’t be needed, since you can overrdide the NodeAppearance property and set the font style and font size there. It could be achieved with the following code:
var ovr = this.ultraTree1.Override;
ovr.NodeAppearance.FontData.Name = "Tahoma";
ovr.NodeAppearance.FontData.SizeInPoints = 10;
I am attaching the sample that I have tested with as well as an image that demonstrates the behavior on my side:
Please test the sample on your side and let me know if you have any questions or concerns.
Regards, Ivan Kitanov
TreeLongNodeText.zip
Hi Ivan,
Thanks for your quick response.
I need to use the UltraFormattedTextEditor because it is required to format the node text. E.g. I am searching a string which needs to be highlighted in all the nodes if present. Refer following screenshot. From the documentation what I learnt is such formatting is not possible without formatted text editor.
Regarding the properties I have not override any properties other than editorcontrol. Following are the screenshots of my tree property window.
Please let me know if more information is required.
Thanks!
-Kaustubh Wadi
The issue with truncating the text might be coming from the difference between GDI, which is what the MS TextBox uses, and GDI+, which is what our editors use when not in edit mode. You can easily test this by setting the TextRenderingMode on theUltraFormattedTextEditor to GDI. This could be done with the following code:
ultraFormattedTextEditor1.TextRenderingMode = TextRenderingMode.GDI;
Please let me know if you need any further assistance.
Regards,Ivan Kitanov
Thanks again for your reply.
I already tried to set it to GDI. It renders the text properly but it also increases the font size. If you refer to my initial post I need the Font Tahoma with size 10. Following is the screenshot with TextRenderingMode = Default (Left Side Tree) and with TextRenderingMode = GDI (Right Side Tree).
I also tried with setting the font name and font size of UltraFormattedTextEditor to Tahoma and 10 but same result.
Your help is much appreciated.
Warm Regards,
Kaustubh Wadi
The issue with the font might be coming from the fact that GDI+ text will scale linearly in the sense that doubling the height will double the width, however when using GDI. GDI text does not scale linearly, because it tries to make text look better when rendered at a resolution on the order of its stroke width. If you double the height of a GDI font, the width may not exactly double.
Additionally, I have tested the font changes when the OverrideNodeAppearance.FontData.SizeInPoints is not set in design or run-time and the font is looking as expected. I am attaching a screenshot that demonstrates the difference.
With OverrideNodeAppearance.FontData.SizeInPoints:
Without it:
Please consider this approach and let me know if have any questions or concerns.
Thanks you for your continuous support.
I tried without setting the SizeInPoints, but still not getting the font you were getting in your last reply. Please refer following screenshot. Am I missing any other property to set.
Property of the ultratree:
Kaustubh
Below I am sending all of the properties that I am applying on the UltraTree and on the UltraFormattedTextEditor:
var ovr = this.ultraTree1.Override; ovr.ActiveNodeAppearance.BackColor = SystemColors.Highlight; ovr.ActiveNodeAppearance.ForeColor = SystemColors.HighlightText; ovr.NodeAppearance.FontData.Name = "Tahoma"; //ovr.NodeAppearance.FontData.SizeInPoints = 10; ovr.LabelEdit = DefaultableBoolean.True; ovr.UseEditor = DefaultableBoolean.True; ultraFormattedTextEditor1.TextRenderingMode = TextRenderingMode.GDI; ultraFormattedTextEditor1.Appearance.FontData.Name = "Tahoma"; ultraFormattedTextEditor1.Appearance.FontData.SizeInPoints = 10;
Please let me know if have any questions or concerns.
Regards,
Ivan Kitanov