I want to change the image (?, !, etc) in a messagebox styled with the ultramessageboxmanager.
I have created a new class that inherits from UltraMessageBoxManager and implemented a DrawFilter but if I set the new image I get an exception. This is the function I use:
Public Function GetPhasesToFilter(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Infragistics.Win.DrawPhase Implements IUIElementDrawFilter.GetPhasesToFilter
If (TypeOf drawParams.Element Is ImageAndTextUIElement.ImageAndTextDependentImageUIElement) Then
Return DrawPhase.BeforeDrawElement Else Return DrawPhase.None End If
End Function
Public Function DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean Implements IUIElementDrawFilter.DrawElement
ReplaceImage(drawParams.Element, _img) ' Return false to allow the phase to continue Return FalseEnd Function
Private Sub ReplaceImage(ByRef element As UIElement, img As Image) If (TypeOf element Is ImageAndTextUIElement.ImageAndTextDependentImageUIElement) Then Dim ui As ImageAndTextUIElement.ImageAndTextDependentImageUIElement = element ui.Image = img 'This line causes an exception. End If End Sub
Hello Erik,
The 'ImageAndTextUIElementEx' is an 'UIElement' for displaying both an image and text. The 'ImageAndTextDependentImageUIElement' is an image UIElement for use by Infragistics.Win.ImageAndTextUIElement.
I believe that the following link could help you:
http://geekswithblogs.net/devin/archive/2005/11/17/60406.aspx.
Please do not hesitate to contact us if you need any additional assistance.
I will answer my own question ;-):
Seems you have to use ImageAndTextUIElementEx instead of ImageAndTextUIElement.ImageAndTextDependentImageUIElement and then it works.
Is there any decent documentation about what these classes are for exactly? (except for a listing of properties)?