mpappert Posted March 11, 2003 Posted March 11, 2003 Background Gradient Fill Hey Everyone, I'm trying to paint a background gradient on my forms, but I can't 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. Quote
*Experts* Bucky Posted March 11, 2003 *Experts* Posted March 11, 2003 The Paint event is the correct event to paint in. The WithEvents keyword goes in the Form1's declaration. The declaration also has to be outside any methods, in the General Declarations section of a class. Dim WithEvents myForm As New Form1() To create an event handler for the Paint event, you'd have a sub declaration like this: Private Sub myForm_Paint(sender As Object, e As PaintEventArgs) Handles myForm.Paint Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Gurus* divil Posted March 11, 2003 *Gurus* Posted March 11, 2003 If he's trying to write the code in the form itself, he doesn't need a withevents - he should just select Base Class Events in the left combo box and Paint in the right. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.