home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch06 / clrgrads / frmgrad.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-20  |  4.2 KB  |  132 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Fancy Background"
  5.    ClientHeight    =   4530
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6975
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   302
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   465
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.TextBox Text1 
  15.       BackColor       =   &H00E0E0E0&
  16.       BeginProperty Font 
  17.          Name            =   "Tahoma"
  18.          Size            =   9.75
  19.          Charset         =   0
  20.          Weight          =   400
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   2655
  26.       Left            =   600
  27.       MultiLine       =   -1  'True
  28.       TabIndex        =   3
  29.       Top             =   840
  30.       Width           =   5775
  31.    End
  32.    Begin VB.CommandButton Command3 
  33.       Caption         =   "E X I T"
  34.       BeginProperty Font 
  35.          Name            =   "Tahoma"
  36.          Size            =   11.25
  37.          Charset         =   0
  38.          Weight          =   400
  39.          Underline       =   0   'False
  40.          Italic          =   0   'False
  41.          Strikethrough   =   0   'False
  42.       EndProperty
  43.       Height          =   495
  44.       Left            =   5040
  45.       TabIndex        =   2
  46.       Top             =   3720
  47.       Width           =   1335
  48.    End
  49.    Begin VB.CommandButton Command2 
  50.       Caption         =   "Save File"
  51.       BeginProperty Font 
  52.          Name            =   "Tahoma"
  53.          Size            =   11.25
  54.          Charset         =   0
  55.          Weight          =   400
  56.          Underline       =   0   'False
  57.          Italic          =   0   'False
  58.          Strikethrough   =   0   'False
  59.       EndProperty
  60.       Height          =   495
  61.       Left            =   2160
  62.       TabIndex        =   1
  63.       Top             =   3720
  64.       Width           =   1335
  65.    End
  66.    Begin VB.CommandButton Command1 
  67.       Caption         =   "Open File"
  68.       BeginProperty Font 
  69.          Name            =   "Tahoma"
  70.          Size            =   11.25
  71.          Charset         =   0
  72.          Weight          =   400
  73.          Underline       =   0   'False
  74.          Italic          =   0   'False
  75.          Strikethrough   =   0   'False
  76.       EndProperty
  77.       Height          =   495
  78.       Left            =   600
  79.       TabIndex        =   0
  80.       Top             =   3720
  81.       Width           =   1335
  82.    End
  83.    Begin VB.Label Label1 
  84.       Alignment       =   2  'Center
  85.       BackStyle       =   0  'Transparent
  86.       Caption         =   "Fancy Editor"
  87.       BeginProperty Font 
  88.          Name            =   "Century Schoolbook"
  89.          Size            =   27.75
  90.          Charset         =   0
  91.          Weight          =   700
  92.          Underline       =   0   'False
  93.          Italic          =   0   'False
  94.          Strikethrough   =   0   'False
  95.       EndProperty
  96.       ForeColor       =   &H0000FFFF&
  97.       Height          =   735
  98.       Left            =   840
  99.       TabIndex        =   4
  100.       Top             =   120
  101.       Width           =   5055
  102.    End
  103. Attribute VB_Name = "Form1"
  104. Attribute VB_GlobalNameSpace = False
  105. Attribute VB_Creatable = False
  106. Attribute VB_PredeclaredId = True
  107. Attribute VB_Exposed = False
  108. Option Explicit
  109. Private Sub Form_Resize()
  110. Dim newColor As Long
  111. Dim ipixel, PWidth As Integer
  112. Dim redInc, greenInc, blueInc As Single
  113. Dim color1 As Long, color2 As Long
  114. Dim startRed, startGreen, startBlue As Integer
  115. Dim endRed, endGreen, endBlue As Integer
  116.     startRed = 100
  117.     endRed = 220
  118.     startGreen = 20
  119.     endGreen = 180
  120.     startBlue = 180
  121.     endBlue = 20
  122.         
  123.     PWidth = Form1.ScaleWidth
  124.     redInc = (endRed - startRed) / PWidth
  125.     greenInc = (endGreen - startGreen) / PWidth
  126.     blueInc = (endBlue - startBlue) / PWidth
  127.     For ipixel = 0 To PWidth - 1
  128.         newColor = RGB(startRed + redInc * ipixel, startGreen + greenInc * ipixel, startBlue + blueInc * ipixel)
  129.         Form1.Line (ipixel, 0)-(ipixel, Form1.Height - 1), newColor
  130.     Next
  131. End Sub
  132.