Hi
I am using an UltraTextEditor in a gridbaglayout panel. its is set to dock so that the UTE expands to fill the space given to it.
I have set multiline on so that it does actually fill the space and have set Text Align to middle and centre, hoping that the text will sit in the middle of the UTE in the same way that it does with a label.
However it doesn't, the text sits in the middle of the horizontal axis, but at the top of the box. Is there anything I can do to make it sit in the middle of the vertical axis in the same way an ultralabel works?
My application resizes the windows based on the screen size, and on big displays it looks a bit rubbish.
I am also looking for a way to get the font to resize based on the size of the UTE control so it propotionally readjusts according to the space it has.
Thanks in advance
Hi again,
Could you please inform me, is it my suggestion work for you? If you have any questions, please do not hesitate to ask me
Regards
georgi
Hello Georgi
Please accept my apologies, I did not see your reply
I have ammended the project, what I would like is for the text alignment in the TextEditor to match that of the label ie in the middle(both horizontally and vertically), but what it does is sit in the middle at the top
I have modified the Appearance.TextHAlign and Appearance.TextVAlign to Center amd Middle, but it appears that only the TextHAlign works.
I am still following your case. Have you been able to resolve your issue ? Please keep me in touch.
Georgi
I dont think it is possible. Hopefully somebody may come back with a solution.
Many Thanks Georgi
Hi Larry,
It's not possible when the control is in edit mode. But it can be done when the control is not in edit mode by using a simple CreationFitler. I'm pretty sure I posted some sample code in the link I provided above. It may have to be modified a little for UltraTextEditor, since the original code for the grid.
Let me know if you are having trouble getting that to work.
Hello Mike
I got it to work, Many Thanks!
It would be nice if it worked in edit mode as well but the results are excellent!
I'd updated the base class of my ultraTextEditor and the new base class was forcing the AlwaysInEditMode flag to true.
Thank you for helping me out, the control now works again.
There's not much I can do with a couple of vb files. In order to do anything helpful here, I would need a complete sample project that I could run.
But based on your last post, it sounds like the control is never leaving edit mode.Remember - the code I posted here will not work unless the UltraTextEditor is not in edit mode.
Did you set AlwaysInEditMode to true?
Me.Label.AlwaysInEditMode = True
I can upload my controls source code if this will help with the investigation, you'll have to tell me how though
Hi Mike
Thank you for your help so far
The code you posted was more like the code I had originally (having copied it from the grid example)
what seems to be happening is the drawParams.Element is only ever getting the values
Infragistics.Win.UltraWinEditors.UltraTextEditorUIElement
and
Infragistics.Win.EditorWithTextUIElement
it did use to get EditorWithTextDisplayTextUIElement but this is no longer turning up, so I never get to return DrawPhase.BeforeDrawForeground
I dont know what I did to upset it !
Hi,
Hmm... are you sure this was working before? This doesn't seem right to me.I don't think the UltraTextEditorUIElementis what actually draws the text.
The EditorWithTextDisplayTextUIElement is the element you want.
Also... I doubt this has anything to do with the issue, but it's not good practice to set AppearanceData properties inside the GetPhasesToFilter method. And in this case, it's redundant.
#Region "IUIElementDrawFilter Members" Private Function IUIElementDrawFilter_DrawElement(ByVal drawPhase As DrawPhase, ByRef drawParams As UIElementDrawParams) As Boolean Implements IUIElementDrawFilter.DrawElement drawParams.AppearanceData.TextVAlign = VAlign.Middle Return False End Function Private Function IUIElementDrawFilter_GetPhasesToFilter(ByRef drawParams As UIElementDrawParams) As DrawPhase Implements IUIElementDrawFilter.GetPhasesToFilter If TypeOf drawParams.Element Is EditorWithTextDisplayTextUIElement Then Return DrawPhase.BeforeDrawForeground End If Return DrawPhase.None End Function#End RegionEnd Class