VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6120
   ClientLeft      =   1815
   ClientTop       =   1755
   ClientWidth     =   7320
   LinkTopic       =   "Form1"
   ScaleHeight     =   6007.102
   ScaleMode       =   0  'User
   ScaleWidth      =   7320
   Begin VB.CommandButton Command4 
      Caption         =   "Окружность"
      Height          =   375
      Left            =   5520
      TabIndex        =   6
      Top             =   3120
      Width           =   1575
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Пуск"
      Height          =   375
      Left            =   5520
      TabIndex        =   5
      Top             =   3720
      Width           =   1575
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Очистка"
      Height          =   375
      Left            =   5520
      TabIndex        =   4
      Top             =   4320
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   615
      Left            =   5520
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   2280
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   5520
      MultiLine       =   -1  'True
      TabIndex        =   2
      Top             =   840
      Width           =   1575
   End
   Begin VB.PictureBox Pic1 
      BackColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "Courier"
         Size            =   9.75
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   4935
      Left            =   120
      ScaleHeight     =   4875
      ScaleWidth      =   4875
      TabIndex        =   1
      Top             =   120
      Width           =   4935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "выход"
      Height          =   375
      Left            =   6240
      TabIndex        =   0
      Top             =   5520
      Width           =   855
   End
   Begin VB.Label Label4 
      ForeColor       =   &H000000FF&
      Height          =   615
      Left            =   2640
      TabIndex        =   10
      Top             =   5280
      Width           =   2295
   End
   Begin VB.Label Label3 
      Height          =   615
      Left            =   120
      TabIndex        =   9
      Top             =   5280
      Width           =   2175
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "Площадь круга при бросании случайных чисел"
      Height          =   615
      Left            =   5520
      TabIndex        =   8
      Top             =   1680
      Width           =   1575
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "Площадь круга"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5400
      TabIndex        =   7
      Top             =   360
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim n1 As Long, n2 As Long, r As Single, s1 As Single, s2 As Single, i As Single, x As Single, y As Single

Private Sub Command1_Click()
End
End Sub

Private Sub Command2_Click()
Pic1.Cls
End Sub

Private Sub Command3_Click()
Pic1.Scale (-ScaleWidth, ScaleHeight)-(ScaleWidth, -ScaleHeight)

r = ScaleHeight
s2 = 0
s1 = 0
n2 = 0
Randomize Timer
For i = 1 To n1
x = Int(Rnd * 2 * r) - r
y = Int(Rnd * 2 * r) - r
If x ^ 2 + y ^ 2 <= r ^ 2 Then
n2 = n2 + 1
Pic1.PSet (x, y), vbRed
Else
Pic1.PSet (x, y), 0

End If
Next
Pic1.Line (-r, 0)-(r, 0), 0
For i = -r To r Step r
Pic1.PSet (i, 0)
Pic1.Print i
Next
Pic1.Line (0, -r)-(0, r), 0
For i = -r To r Step r
Pic1.PSet (0, i)
Pic1.Print i
Next
For i = 0 To 6.28 Step 0.01
x = r * Cos(i)
y = r * Sin(i)
Pic1.PSet (x, y), vbRed
Next

s2 = 4 * r ^ 2 * n2 / n1
s1 = 3.14 * r ^ 2
Text1.Text = Str(s1)
Text2.Text = Str(s2)
Label3.Caption = "Точек в квадрате " + Str(n1)
Label4.Caption = "Точек в круге " + Str(n2)

'n1 = n1 + n1

End Sub

Private Sub Command4_Click()
n1 = InputBox("Введите количество точек n")
Pic1.Cls

Pic1.Line (-r, 0)-(r, 0), 0
For i = -r To r Step r
Pic1.PSet (i, 0)
Pic1.Print i
Next
Pic1.Line (0, -r)-(0, r), 0
For i = -r To r Step r
Pic1.PSet (0, i)
Pic1.Print i
Next
For i = 0 To 6.28 Step 0.01
x = r * Cos(i)
y = r * Sin(i)
Pic1.PSet (x, y), vbRed
Next


End Sub

Private Sub Form_DblClick()
r = InputBox("Введите радиус от 1 до 100")

Pic1.Scale (-r, r)-(r, -r)

End Sub

Private Sub Form_Load()
r = InputBox("Введите радиус от 1 до 100")

Pic1.Scale (-r, r)-(r, -r)
End Sub

Private Sub Form_Resize()
Command1.Left = ScaleWidth - 1300
Command1.Top = ScaleHeight - 500
Command2.Left = ScaleWidth - 1700
Command2.Top = ScaleHeight - 1300
Command3.Left = ScaleWidth - 1700
Command3.Top = ScaleHeight - 1900
Command4.Left = ScaleWidth - 1700
Command4.Top = ScaleHeight - 2500
Text2.Left = ScaleWidth - 1700
Text2.Top = ScaleHeight - 3200
Label2.Left = ScaleWidth - 1700
Label2.Top = ScaleHeight - 3800
Text1.Left = ScaleWidth - 1700
Text1.Top = ScaleHeight - 4600
Label1.Left = ScaleWidth - 1700
Label1.Top = ScaleHeight - 5000
If ScaleWidth > 1900 Then Pic1.Width = ScaleWidth - 1900
If ScaleHeight > 1700 Then Pic1.Height = ScaleHeight - 1700
Label3.Left = ScaleWidth - 6600
Label3.Top = ScaleHeight - 500
Label4.Left = ScaleWidth - 4400
Label4.Top = ScaleHeight - 500

End Sub

