Newer
Older
Microsoft / setcolor / FORM1.FRM
@tundra tundra on 24 May 2012 4 KB Initial revision
VERSION 4.00
Begin VB.Form Setcolor 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Tundra's Setcolor Demo (Because Amir Is Feeble)"
   ClientHeight    =   4248
   ClientLeft      =   1968
   ClientTop       =   2340
   ClientWidth     =   6444
   BeginProperty Font 
      name            =   "MS Sans Serif"
      charset         =   0
      weight          =   700
      size            =   24
      underline       =   0   'False
      italic          =   0   'False
      strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   Height          =   4632
   Left            =   1920
   LinkTopic       =   "Form1"
   ScaleHeight     =   4248
   ScaleWidth      =   6444
   Top             =   2004
   Width           =   6540
   Begin VB.HScrollBar BScroll 
      Height          =   612
      Left            =   3480
      Max             =   15
      TabIndex        =   4
      Top             =   2880
      Width           =   492
   End
   Begin VB.HScrollBar FScroll 
      Height          =   612
      Left            =   2280
      Max             =   15
      TabIndex        =   3
      Top             =   2880
      Width           =   492
   End
   Begin VB.CommandButton Background 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Back"
      BeginProperty Font 
         name            =   "MS Sans Serif"
         charset         =   0
         weight          =   700
         size            =   7.8
         underline       =   0   'False
         italic          =   0   'False
         strikethrough   =   0   'False
      EndProperty
      Height          =   852
      Left            =   3360
      TabIndex        =   1
      Top             =   1800
      Width           =   732
   End
   Begin VB.CommandButton Foreground 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Fore"
      BeginProperty Font 
         name            =   "MS Sans Serif"
         charset         =   0
         weight          =   700
         size            =   7.8
         underline       =   0   'False
         italic          =   0   'False
         strikethrough   =   0   'False
      EndProperty
      Height          =   852
      Left            =   2160
      TabIndex        =   0
      Top             =   1800
      Width           =   732
   End
   Begin VB.Label SampleText 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Sample Text"
      BeginProperty Font 
         name            =   "Courier New"
         charset         =   0
         weight          =   700
         size            =   18
         underline       =   0   'False
         italic          =   0   'False
         strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   852
      Left            =   2040
      TabIndex        =   2
      Top             =   720
      Width           =   2196
   End
End
Attribute VB_Name = "Setcolor"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Dim FColor As Integer
Dim BColor As Integer

Private Sub Background_Click()
    If (BColor = 15) Then
        BColor = 0
    Else
        BColor = BColor + 1
    End If
    BScroll.Value = BColor
    Call setem
End Sub

Private Sub BScroll_Change()
    BColor = BScroll.Value
    Call setem
End Sub

Private Sub Foreground_Click()
    If (FColor = 15) Then
        FColor = 0
    Else
        FColor = FColor + 1
    End If
    FScroll.Value = FColor
    Call setem
End Sub

Private Sub Form_Load()
    FColor = 0
    BColor = 15
    FScroll.Value = FColor
    BScroll.Value = BColor
    SampleText.ForeColor = QBColor(FColor)
    SampleText.BackColor = QBColor(BColor)
End Sub

Private Sub FScroll_Change()
    FColor = FScroll.Value
    Call setem
End Sub

Private Sub setem()
    SampleText.BackColor = QBColor(BColor)
    SampleText.ForeColor = QBColor(FColor)
End Sub