Right now I'm drawing a small 16x16 image on the title bar of my window. It works nicely, except for an obnoxious flicker that I cant figure out how to get rid of.
I'm simply drawing the image like this:
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SIZE Then
wnd_size = New Size(New Point(CInt(m.LParam)))
End If
If m.Msg = WM_ACTIVATE _
OrElse m.Msg = WM_SIZE _
OrElse m.Msg = WM_SYNCPAINT _
OrElse m.Msg = WM_NCACTIVATE _
OrElse m.Msg = WM_NCCREATE _
OrElse m.Msg = WM_NCPAINT _
OrElse m.Msg = WM_NCACTIVATE _
OrElse m.Msg = WM_NCHITTEST _
OrElse m.Msg = WM_PAINT _
OrElse m.Msg = WM_MOUSEMOVE Then
Dim g As Graphics = Graphics.FromHdc(CType(GetWindowDC(CInt(Handle)), IntPtr))
g.DrawImage(My.Resources.drag, 0, 0, 16, 16)
End If
MyBase.WndProc(m)
End Sub
Its repainting the entire title bar each time something is changed on it(click, mouseover the corner buttons, etc), and its during the repaint I get the flicker.
Anyone else ever get this problem?