Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • *Experts*
Posted

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

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...