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.
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!
Hi Larry,
Glad to hear it.
Out of curiosity - if this is a touchscreen application, then why does the UltraTextEditor ever have to enter edit mode? And if it does not have to enter edit mode, why use an UltraTextEditor? Wouldn't an UltraLabel or UltraFormattedLinkLabel make more sense? Using one of those controls, you would not need a CreationFilter.
Hi Mike
Originally I was using an ultra label, but there are times when it is easier to key the value in.
Can you point me to documentation on using Creation and Draw filters, the next thing I want to do is create a sizable button with a scaling vector based Arrow in it, as bitmaps get lumpy and dont scale automatically
I'm honestly not sure if CreationFilters or DrawFilters have any detailed documentation anywhere. They are basically for advanced users who want to customize the UIElements of a control.
It sounds like what you are describing would be easier to accomplish by imply generating an image (Bitmap) on the fly.
I thought I had this draw filter working, but it just seems to have stopped and I'm not sure why.
The IUIElementDrawFilter_DrawElement never seems to get called
Can you check over my code and let me know what I've done wrong?
many thanks in advance
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
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