Background Gradient Fill (VB)

mpappert

Well-known member
Joined
Oct 5, 2002
Messages
58
Location
Ottawa, ON, Canada
Background Gradient Fill

Hey Everyone,

Im trying to paint a background gradient on my forms, but I cant intercept the Form1_Paint because there is no WithEvents declared. Can someone help me out with where I should place the WithEvents code (and what it should read) or if there is another method I should use to give the background a gradient fill ..

Thanks!
M.
 
The Paint event is the correct event to paint in. The WithEvents
keyword goes in the Form1s declaration.

The declaration also has to be outside any methods, in the
General Declarations section of a class.

Code:
Dim WithEvents myForm As New Form1()

To create an event handler for the Paint event, youd have a sub
declaration like this:
Code:
Private Sub myForm_Paint(sender As Object, e As PaintEventArgs) Handles myForm.Paint
 
If hes trying to write the code in the form itself, he doesnt need a withevents - he should just select Base Class Events in the left combo box and Paint in the right.
 
Back
Top