How can I overlay a transparent image that stay on top of anything in the form?
I tried various solutions but none do the job. A picturebox or a panel stays on top but no way to get alpha transparency to work.
The nearest result achived is with a custom control:
Public Class TransparentImage
Private Sub TransparentImage_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawImage(My.Resources.Demo, 0, 0, 100, 100)
End Sub
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H20
Return cp
End Get
End Property
End Class
I draw the png in the paint event. The result is good for the transparency but the overlay is deleted or partially deleted as soon as some control below updates (ex. a datagriview scroll).