Form_Paint occurs 3 times? 
Author Message
 Form_Paint occurs 3 times?

I've got a small form that is used to display a simple map (a dozen
non-overlapping polygons).  The forms Form_Paint event is as follows:

Sub Form_Paint ()
Call PaintAllPolygons(SmallMapForm.hDC, 1)
End Sub

The Sub PaintAllPolygons merely loops through an array and uses
CreatePolygonRgn to create a region for each polygon, then uses
CreateSolidBrush to create a brush of the correct color (based on
an entry in a database), and finally uses FillRgn% to fill that region
with the appropriate color.

The problem I'm having is that when I show the form, the Form_Load event
occurs once but the Form_Paint event happens 3 times!  While the final
result is OK (the polygons are drawn and filled as they are supposed to
be) it wastes time redrawing something 3 times that was correct the first
time.  Does anyone have any idea why the Form_Paint is executed 3 times
when the form is loaded?  Any help would be greatly appreciated.

Thanks in advance,

Dave Hamilton

Tue, 04 Aug 1998 03:00:00 GMT  
 Form_Paint occurs 3 times?
Try the following code;


        '   Your Code

End Sub

Steve 'n' Chris

Wed, 05 Aug 1998 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. VBScript Run-time Error 507 - An exception occurred

2. Strange UserControl behaviour when run-time error occurs

3. Form_Paint gets decoupled ???

4. labels dissapear mysteriously with Form_Paint

5. Strange behavior of Form_Paint and X close button.

6. Problem with MDI and Form_Paint

7. How to unload a form while its still busy with Form_Paint

8. Detecting WM_SYSCOLORCHANGE Message in Form_Paint

9. SelectClipRgn fails in Form_Paint()

10. Time, TIME TIME

11. Daylight saving - winter time - summer time - time zone

12. Daylight saving - winter time - summer time - time zone


Powered by phpBB® Forum Software