home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form ClrGradsForm
- BorderStyle = 4 'Fixed ToolWindow
- Caption = "Gradients"
- ClientHeight = 5415
- ClientLeft = 45
- ClientTop = 285
- ClientWidth = 6075
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 5415
- ScaleWidth = 6075
- ShowInTaskbar = 0 'False
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Linear Gradient"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 750
- TabIndex = 4
- Top = 210
- Width = 1665
- End
- Begin VB.PictureBox EndColor
- AutoRedraw = -1 'True
- BackColor = &H0000FFFF&
- Height = 5205
- Left = 5505
- ScaleHeight = 5145
- ScaleWidth = 390
- TabIndex = 3
- Top = 120
- Width = 450
- End
- Begin VB.PictureBox StartColor
- AutoRedraw = -1 'True
- BackColor = &H00FFFF00&
- Height = 5220
- Left = 105
- ScaleHeight = 5160
- ScaleWidth = 390
- TabIndex = 2
- Top = 90
- Width = 450
- End
- Begin VB.PictureBox Picture2
- AutoRedraw = -1 'True
- BackColor = &H00404040&
- Height = 2385
- Left = 2145
- Picture = "ClrGrads.frx":0000
- ScaleHeight = 155
- ScaleMode = 3 'Pixel
- ScaleWidth = 197
- TabIndex = 1
- Top = 2775
- Width = 3015
- Begin VB.CommandButton Command2
- BackColor = &H8000000A&
- Caption = "Circular Gradient"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 75
- TabIndex = 5
- Top = 1890
- Width = 1890
- End
- End
- Begin VB.PictureBox Picture1
- AutoRedraw = -1 'True
- Height = 5175
- Left = 675
- Picture = "ClrGrads.frx":0446
- ScaleHeight = 341
- ScaleMode = 3 'Pixel
- ScaleWidth = 309
- TabIndex = 0
- Top = 120
- Width = 4695
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 4740
- Top = 4005
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- FontSize = 2.54052e-29
- End
- Attribute VB_Name = "ClrGradsForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Function GetRed(colorVal As Long) As Integer
- GetRed = colorVal Mod 256
- End Function
- Function GetGreen(colorVal As Long) As Integer
- GetGreen = ((colorVal And &HFF00FF00) / 256&)
- End Function
- Function GetBlue(colorVal As Long) As Integer
- GetBlue = (colorVal And &HFF0000) / (256& * 256&)
- End Function
- Private Sub Command1_Click()
- Dim newColor As Long
- Dim ipixel As Integer, PWidth As Integer
- Dim redInc As Single, greenInc As Single, blueInc As Single
- Dim color1 As Long, color2 As Long
- Dim startRed As Integer, startGreen As Integer, startBlue As Integer
- Dim endRed As Integer, endGreen As Integer, endBlue As Integer
- color1 = StartColor.BackColor
- color2 = EndColor.BackColor
- startRed = GetRed(color1)
- endRed = GetRed(color2)
- startGreen = GetGreen(color1)
- endGreen = GetGreen(color2)
- startBlue = GetBlue(color1)
- endBlue = GetBlue(color2)
- PWidth = Picture1.ScaleWidth
- redInc = (endRed - startRed) / PWidth
- greenInc = (endGreen - startGreen) / PWidth
- blueInc = (endBlue - startBlue) / PWidth
- For ipixel = 0 To PWidth - 1
- newColor = RGB(startRed + redInc * ipixel, startGreen + greenInc * ipixel, startBlue + blueInc * ipixel)
- Picture1.Line (ipixel, 0)-(ipixel, Picture1.Height - 1), newColor
- Next
- End Sub
- Private Sub Command2_Click()
- Dim newColor As Long
- Dim radius As Integer, ipixel As Integer, PWidth As Integer
- Dim redInc As Single, greenInc As Single, blueInc As Single
- Dim color1 As Long, color2 As Long
- Dim startRed As Integer, startGreen As Integer, startBlue As Integer
- Dim endRed As Integer, endGreen As Integer, endBlue As Integer
- color1 = StartColor.BackColor
- color2 = EndColor.BackColor
- startRed = color1 Mod 256
- endRed = color2 Mod 256
- startGreen = ((color1 And &HFF00) / 256&) Mod 256&
- endGreen = ((color2 And &HFF00) / 256&) Mod 256&
- startBlue = (color1 And &HFF0000) / (256& * 256&)
- endBlue = (color2 And &HFF0000) / (256& * 256&)
- PWidth = Picture1.ScaleWidth / 2
- redInc = (endRed - startRed) / PWidth
- greenInc = (endGreen - startGreen) / PWidth
- blueInc = (endBlue - startBlue) / PWidth
- Picture2.DrawWidth = 2
- ipixel = 0
- For radius = PWidth / 2 To 1 Step -1
- newColor = RGB(startRed + redInc * ipixel, startGreen + greenInc * ipixel, startBlue + blueInc * ipixel)
- Picture2.Circle (Picture2.ScaleWidth / 2, Picture2.ScaleHeight / 2), radius, newColor
- ipixel = ipixel + 2
- Next
- End Sub
- Private Sub EndColor_Click()
- CommonDialog1.Color = EndColor.BackColor
- CommonDialog1.ShowColor
- EndColor.BackColor = CommonDialog1.Color
- End Sub
- Private Sub StartColor_Click()
- CommonDialog1.Color = StartColor.BackColor
- CommonDialog1.ShowColor
- StartColor.BackColor = CommonDialog1.Color
- End Sub
-