Link to home
Start Free TrialLog in
Avatar of mytonytiger
mytonytiger

asked on

Paint Event Question

Using VB.NET:

How can I subscribe to the "BeginPaint" and "EndPaint" events of a control or form with managed code?

Thanks,
Tony

Avatar of mytonytiger
mytonytiger

ASKER

Further information of interest is:

I'm using Visual Studio 2005, hence, .NET 2.0

I'm interested in captureing the event for panel control so I can reset the scroll bars to the position they were in before the paint event.
ASKER CERTIFIED SOLUTION
Avatar of GilesBathgate
GilesBathgate

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm trying to find the constants now, but so far no luck.

if you can find them, please post them. Then I can check out the solution
Thanks.
Yes, I had seen this... but no reference to a "BeforePaint" or "AfterPaint" event.

So, I've done this and it seems to be working.

    Protected Overrides Sub WndProc(ByRef m As Message)
        If m.Msg = 15 Then
            'Do code before paint here.
        End If
        MyBase.WndProc(m)
        If m.Msg = 15 Then
            'Do Code after paint here.
        End If
    End Sub
Yeah I assumed that there was actually some Windows Message that you were aware of trying to hook into your application.
well, there are several pages in the net referring to a "BeginPaint" and and "EndPaint" event. But, I guess they aren't actual windows messages.
Thanks for the help. I do appreciate it.