Our manufacturing software uses Infragistics win controls. (v6.3) Formatted text (with CR/LF embedded) displays as expected. Clicking in the text area of the text box to either edit or select some text causes formatting to disappear resulting in the text shifting within the control. Even plain text with no formatting shifts between when text is displayed and the box is clicked causing the caret insertion position to be off by several characters.
Is this designed behavior? Is this something that can be set in the control properties?
Thanks.
I had the same problem. I was able to resolve it by switching the "TextRenderingMode" from "Default" (Which is GDI+ I believe) to "GDI". That seemed to solve it.
-Anthony
http://www.coffeeandcoding.com
I am using an UltraTextEditor (v10.3) set to multi-line; when I switch to the GDI TextRendermingMode, the text box does not wrap the text unless you are in edit mode. It just extends one long top line and so a bunch of text is cut off.
Is there another way around this text shifting so that I can still use a multi-line text box? Users are complaining about it, and I'm responsible for the fix.
Thanks,
J
Hi J,
I tried this out and it works just fine for me. I am attaching my sample here which is using v10.3 of the UltraTextEditor. I also tried it out with v10.2.
The sample shows two UltraTextEditors which are identical except one is using GDI+ (default) and the other is using GDI.the only other property I set on both control is the Multiline property, which I set to true.
They both display correctly at design-time and at run-time when I tab between the two controls. So they are working whether they are in edit mode or not.
Hey Mike,
Thanks for getting back to me on this. I took your sample project and ran it straight up, then ran it again after converting it to Visual Studio 2010. Both result in the same reproducible problem: the text shifting.
I'm attaching a zip file with two screenshots, one with the GDI+ text box in edit mode, the other with the GDI box in edit mode (you will see the cursor in the relevant text box in each screenshot).
What you will see is that the spacing in the GDI+ text box changes between the two screenshots, enough so that the word 'line' actually wraps around to a new line when the GDI+ text box is not in edit mode.
I have tested on multiple monitors and multiple operating systems. Let me know what you think.
Thanks again,
I'm a little confused. Your post about was saying that the text was not wrapping at all in GDI mode. Now you seem to be talking about some completely different issue. I can see from the screen shot that the sample application I posted here is working correctly and that the text is wrapping for you in GDI mode. So doesn't that solve the problem you were trying to solve?
As for the text shifting, this is a results of GDI+ text rendering. When the UltraTextEditor is not in edit mode, it draws using GDI+, but when it goes into edit mode, it uses a TextBox control, which always uses GDI. So the text appears to shift.
Sorry for the confusion, my post about the wrapping issue was related to the text-shifting because I was trying to use GDI to eliminate the text-shifting, but it resulted in the wrapping problem. That's why I posted on this thread, because my original problem was the text-shifting.
Which is fine now, thanks--the problem was that I was pre-populating with text that didn't have a space in it, basically 0123456789 repeated again and again so I could fill the text box with the max number of characters from the data field and then size the text box accordingly. In the GUI designer, it won't wrap the long text in GDI mode.
But it works fine when I run it, thanks again for the help.
--J