VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Boxgradient module

by stephane swertvaegher (20 Submissions)
Category: Complete Applications
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

A very neat effect to color your forms or pictureboxes. This code is very
small but very usefull. A MUST HAVE for anyone who likes different forms...

Assumes
The routine must be stored in a module. This effect can be done in a form or a picturebox. If you call it in the load-event, remember to set the autoredraw property to true. Syntax: Call BoxGradient(Object,r,g,b,rstep,gstep,bstep,direc) where: object = the form or picturebox r,g,b = the starting-colors of the gradient rstep,gstep,bstep: the amount of increasing the colors direc: true or false For example: Call BoxGradient(Form1,128, 64, 0, 1, 2, 2, False) [email protected]

Rate Boxgradient module

Option Explicit
Public Sub BoxGradient(OBJ As Object, R%, G%, B%, RStep%, GStep%, BStep%, Direc As Boolean)
Dim s%, xpos%, ypos%
OBJ.ScaleMode = 3 'pixel
If Direc = True Then
RStep% = -RStep%
GStep% = -GStep%
BStep% = -BStep%
End If
DoBox:
s% = s% + 1
If xpos% < Int(OBJ.ScaleWidth / 2) Then xpos% = s%
If ypos% < Int(OBJ.ScaleHeight / 2) Then ypos% = s%
OBJ.Line (xpos%, ypos%)-(OBJ.ScaleWidth - xpos%, OBJ.ScaleHeight - ypos%), RGB(R%, G%, B%), B
R% = R% - RStep%
If R% < 0 Then R% = 0
If R% > 255 Then R% = 255
G% = G% - GStep%
If G% < 0 Then G% = 0
If G% > 255 Then G% = 255
B% = B% - BStep%
If B% < 0 Then B% = 0
If B% > 255 Then B% = 255
If xpos% = Int(OBJ.ScaleWidth / 2) And ypos% = Int(OBJ.ScaleHeight / 2) Then
Exit Sub
End If
GoTo DoBox
End Sub

Download this snippet    Add to My Saved Code

Boxgradient module Comments

No comments have been posted about Boxgradient module. Why not be the first to post a comment about Boxgradient module.

Post your comment

Subject:
Message:
0/1000 characters