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!

Making color gradient

Status
Not open for further replies.

Pinan

IS-IT--Management
Jul 15, 2002
40
US
I am trying to get background color to fade. Such as a dark blue on the lower left corner, fading over to a light blue on the upper right right. Anybody done this before?
 
Can't be done on the background, but what you do is this.

Find a picture of what you want, and then set the forms picture property to the picture you found.

You will then see on the form what you are looking for. Craig, mailto:sander@cogeco.ca

Si hoc legere scis, nimis eruditionis habes
 
Course it can be done! Just need some free time to put together some example code...
 
You mean by drawing across the form?

But a picture is sooo much faster. Craig, mailto:sander@cogeco.ca

Si hoc legere scis, nimis eruditionis habes
 

You can use a variation of the gradient fill in the formload of the setup1 project.
 

as it may be so much more limiting, but while Pinan is waiting on you to put your code together Pinan could be checking it out themselves.

Something given is worthless, something earned is priceless.

 
I have it working in a line by line format, going either up or down, but I was hoping to find something a bit smoother.
 
Erm, vb5prgrmr, my comment was to CraigSander not to you since your comment wasn't in the thread when I typed it.

However, now you've attracted my attention, would you care to explain which particular gradient fill you are referring to?

I'm assuming you mean the API call, so I suggest that you need to mention that it doesn't work under Windows 95 or NT4.

 

Hmmm, strongm I thought you were refering to my post, and the gradient fill I am talking about is in the setup1 project that you can customize to make your own specialized setup programs.

Here is the code from the setup program (frmSetup1).

[tt]
'-----------------------------------------------------------
' SUB: DrawBackGround
'
' Draws the 'blue wash' screen and prints the 'shadowed'
' app setup title
'-----------------------------------------------------------
'
Private Sub DrawBackGround()
Const intBLUESTART% = 255
Const intBLUEEND% = 0
Const intBANDHEIGHT% = 2
Const intSHADOWSTART% = 8
Const intSHADOWCOLOR% = 0
Const intTEXTSTART% = 4
Const intTEXTCOLOR% = 15
Const intRed% = 1
Const intGreen% = 2
Const intBlue% = 4
Const intBackRed% = 8
Const intBackGreen% = 16
Const intBackBlue% = 32
Dim sngBlueCur As Single
Dim sngBlueStep As Single
Dim intFormHeight As Integer
Dim intFormWidth As Integer
Dim intY As Integer
Dim iColor As Integer
Dim iRed As Single, iBlue As Single, iGreen As Single

'
'Get system values for height and width
'
intFormHeight = ScaleHeight
intFormWidth = ScaleWidth

If Len(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR)) = 0 Then
iColor = intBlue
Else
iColor = CInt(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR))
End If
'Calculate step size and blue start value
'
sngBlueStep = intBANDHEIGHT * (intBLUEEND - intBLUESTART) / intFormHeight
sngBlueCur = intBLUESTART

'
'Paint blue screen
'
For intY = 0 To intFormHeight Step intBANDHEIGHT
If iColor And intBlue Then iBlue = sngBlueCur
If iColor And intRed Then iRed = sngBlueCur
If iColor And intGreen Then iGreen = sngBlueCur
If iColor And intBackBlue Then iBlue = 255 - sngBlueCur
If iColor And intBackRed Then iRed = 255 - sngBlueCur
If iColor And intBackGreen Then iGreen = 255 - sngBlueCur
Line (-1, intY - 1)-(intFormWidth, intY + intBANDHEIGHT), RGB(iRed, iGreen, iBlue), BF
sngBlueCur = sngBlueCur + sngBlueStep
Next intY

'
'Print 'shadowed' appname
'
CurrentX = intSHADOWSTART
CurrentY = intSHADOWSTART
ForeColor = QBColor(intSHADOWCOLOR)
Print Caption
CurrentX = intTEXTSTART
CurrentY = intTEXTSTART
ForeColor = QBColor(intTEXTCOLOR)
Print Caption
End Sub
[/tt]

and as you can see I did not mean the API call but then again I was not totally clear either. I probably should have said "wash screen" or blue background on setup or something else.

But then again that is what we get for ASSuME(ing) [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top