Hi Venkateshwaran, you are absolutely right, when I comment out the fill rectangle line, I recover the "item.SelectedColor" and the Item.ItemHoverColor" properties, but unfortunately loosing the "Item.BackgroundGradient" property.
After thinking, I do not mind loosing the "item.SelectedColor", but would like to keep the "Item.ItemHoverColor" property. My guess is that we should write a few lines in the OnPaint Overide, between the FillRectangle and DrawImage (in order to keep the image, while completely repaint the rectangle on a "Hover" event (a new FillRectangle, using probably Me.ItemHoverColor - or a transformation of it as it is in Color format instead of Brush or BrushInfo). When the mouse moves, the OnPaint will be called again, and repaint the rectangles according to mouse new position, and behave like any other normal hover repaint. My guess is that coding shoud be like this, but need to be adapted for catching Hover ONLY
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Me.BackgroundGradient IsNot Nothing Then
Dim g As Graphics = e.Graphics
Syncfusion.Drawing.BrushPaint.FillRectangle(g, New Rectangle(0, 0, Me.Width, Me.Height), Me.BackgroundGradient) '(Me.Width, 10, 30, 30))
End If
If Not IsNothing(ItemHoverColorEx) Then 'HERE NEED TO ADD LIMITING FACTORS TO CATCH HOVER ONLY
Dim br As New SolidBrush(ItemHoverColorEx)
e.Graphics.FillRectangle(br, New Rectangle(0, 0, Me.Width, Me.Height))
End If
If Me.ItemImage IsNot Nothing Then
Dim textSize As SizeF = e.Graphics.MeasureString(Me.Text, Me.Font)
Dim textwidth As Integer = CInt(Fix(Math.Ceiling(textSize.Width)))
'Draw the Menu item image
e.Graphics.DrawImage(Me.ItemImage, New Rectangle(Me.Width - 70, 10, 30, 30))
End If
MyBase.OnPaint(e)
End Sub
oo, do not forget about the Item.Forecolor that is simply not working
Thank you! - Nicolas