Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a form's backcolor 1

Status
Not open for further replies.

aclayborne

Programmer
May 3, 2000
49
US
Is there anyway to set a form's backcolor property to more than one color
Ex. Have half the form green and the other half red?
I tried setting the form's picture property to a red and green bitmap but when I load and unload controls with images in them the form flashes white.


Acie Clayborne
 
You could put either two frames or two picture boxes on your form, halving the form, and then set the backcolor for each of these containers. I don't think you can specify two different background colors for a form.
 
This code will gradient fill a form. You can play with the FillColor property and the loop to get it the way you like.
Maybe loop half way down the form with one color then change colors for the second half.

Private Sub Form_Paint()
Dim vY As Long
Dim vScalewidth As Long
Dim vScaleheight As Long

ScaleMode = vbPixels
vScaleheight = ScaleHeight
vScalewidth = ScaleWidth
DrawStyle = vbInvisible
FillStyle = vbFSSolid

For vY = 0 To vScaleheight
FillColor = RGB(0, 0, 255 - (vY * 255) / vScaleheight)
Line (-1, vY - 1)-(vScalewidth, vY - 1), , B
Next vY

End Sub

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top