Download a free copy of NetMon - Your Internet Performance Monitor at http://www.codeoftheweek.com/netmon/index.html
Get a LIFETIME subscription to Code of the Week for only $49.95 (regularly $59.95). Just jump to our SECRET order page at http://www.codeoftheweek.com/orderforms/lifetime4995.html and see everything you get with this outstanding offer!
In this issue we show how to add a gradient color background to your forms.
This source code is designed for VB 4.0 32-bit and up. Questions? Email us at email@example.com.
The basFormEffects module contains a routine to paint a gradient background on any form. It is designed to work with any form.
If you have any questions about using or creating this control, let us know at firstname.lastname@example.org
Public Sub GradientFill(Obj As Form, lTopColor As Long, lBottomColor As Long)
This subroutine does all the work. It will start with the lTopColor and paint a gradient to lBottomColor on the form specified by Obj. The most common place you see this type of background is in setup programs. They usually have a faded blue to black background. This routine will allow you to specify any of the built-in constants for the colors that VB defines (vbBlack, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan, vbWhite).
Raises an error if any of the internal calls fail. There is no particular error that will be raised.
The below sample describes how to use the GradientFill routine. It assumes you have created a form and added the following code to it. Make sure the AutoRedraw property is False for this sample.
Private Sub Form_Load() Me.Show End Sub Private Sub Form_Paint() GradientFill Me, vbRed, vbWhite End Sub
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0076.html