VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "VB6 例10-18a  图形叠加"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   DrawWidth       =   2
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "XOR 叠加"
      Height          =   435
      Left            =   240
      TabIndex        =   1
      Top             =   2580
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "随机射线"
      Height          =   435
      Left            =   3180
      TabIndex        =   0
      Top             =   2580
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x1 As Single, y1 As Single, x2 As Single, y2 As Single
Private Sub Command1_Click()
    Dim i, colorcode
    For i = 1 To 200
    X = 320 * Rnd                           ' 产生x坐标
    If Rnd < 0.5 Then X = -X
    Y = 240 * Rnd                           ' 产生y坐标
    If Rnd < 0.5 Then Y = -Y
    colorcode = 15 * Rnd                    ' 产生色彩代码
    Line (0, 0)-(X, Y), QBColor(colorcode)
    Next i
End Sub
Private Sub Command2_Click()
    Static X, Y As Single, colorcode As Integer
    Line (0, 0)-(X, Y), QBColor(colorcode), BF
    X = 200 * Rnd
    If Rnd < 0.5 Then X = -X
    Y = 100 * Rnd
    If Rnd < 0.5 Then Y = -Y
    colorcode = 8 * Rnd + 7
    Line (0, 0)-(X, Y), QBColor(colorcode), BF
    DrawWidth = 8
    Circle (0, 0), 150, QBColor(7)
    DrawWidth = 2
End Sub

Private Sub Form_Load()
    Scale (-320, 240)-(320, -240)
    DrawMode = 7                     'xor
    Randomize
End Sub
