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 Mike
here is the code again, it was working, then it stopped. having toyed a bit, it does run the draw element, it just doesn't seem to do anything!
Public Class MiddleAlignDrawFilterImplements IUIElementDrawFilter
#Region "IUIElementDrawFilter Members"
Private Function IUIElementDrawFilter_DrawElement(ByVal drawPhase As DrawPhase, ByRef drawParams As UIElementDrawParams) As Boolean Implements IUIElementDrawFilter.DrawElementdrawParams.AppearanceData.TextVAlign = VAlign.MiddleReturn FalseEnd Function
Private Function IUIElementDrawFilter_GetPhasesToFilter(ByRef drawParams As UIElementDrawParams) As DrawPhase Implements IUIElementDrawFilter.GetPhasesToFilterIf TypeOf drawParams.Element Is UltraWinEditors.UltraTextEditorUIElement ThendrawParams.AppearanceData.TextVAlign = VAlign.MiddleReturn DrawPhase.BeforeDrawForegroundEnd If
Return DrawPhase.NoneEnd Function
#End Region
End Class
Hi Larry,
It's pretty hard to read (looks like the forum butchered it), but I don't see anything wrong with the DrawFilter itself. If it's not getting called at all, then either the control is no longer pointing to an instance of this DrawFilter class or else the control is never painting on the screen.
Public Class MiddleAlignDrawFilter Implements IUIElementDrawFilter
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 UltraWinEditors.UltraTextEditorUIElement Then drawParams.AppearanceData.TextVAlign = VAlign.Middle Return DrawPhase.BeforeDrawForeground End If
Return DrawPhase.None End Function
MiddleAlignDrawFilter
IUIElementDrawFilter
#Region
"IUIElementDrawFilter Members"
.DrawElement
drawParams.AppearanceData.TextVAlign =
.Middle
False
Function
.GetPhasesToFilter
Then
.BeforeDrawForeground
If
.None
#End
Region
Class
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