. , , ,

,,,

Visual Basic — ,

2005 - 2006 . 10 1

2006 .

Visual Basic

QBasic () .

Windows, Visual Basic. Visual Basic.

Visual Basic?

, , ? ? - Visual Basic (VB). VB, , Pascal, C++ .

"" (BASIC) - ", " - " ". " " , , VB.

IMB PC 16- - BASICA, IBM, GW-BASIC QUICK-BASIC. , exe . 1992. Microsoft VB 1.0 - Windows 3.1. VB 3.0, VB 4.0, VB 5.0 VB 6.0. , . Microsoft Office (Word, Excel ..). VBA (Visual Basic for Application). Office.

Visual Basic , msvbvmX0.dll, WindowsSystem. X VB. VB5 - msvbvm50.dll, VB6 - msvbvm60.dll. WinME () Win98 ( msvbvm50.dll), .

Visual Basic () , , . Visual Basic . Visual Basic .

Visual Basic?

, Visual Basic . VB . Visual Basic (DLL ), Visual Basic. .

VB , , . 60% VB. , , VB DLL , VXD, VB .

VB

Visual Basic , . , . , , . , VB 5.0 ( 15), VB 6.0 MSDN, . , , , . VB 6.0. VB .

, . VB . VB (->->Microsoft Visual Basic 6.0->Visual Basic 6). Tools->Options, "Require Variable Declaration". . Editor Format, Font Courier New Cyr. , VB . -. Code Colors Keyword Text Foreground - ( ). ! Visual Basic !

VB

Visual Basic , - :

- ( frm) - ASCII , , , .

- ( frx), ( PictureBox) .

- ( vbp),

- ( vbw) (workspace) .

. (, , , . frm , bas .)

, :

( bas) .

( cls). .

( ctl) .

( res)

(ocx, tlb, ....)

, 2 : frm-, . bas- - . , , .. , . .

VB

, , Visual Basic. VB. (. 1) - "Standart EXE" .

. 1

( 2).

, . (), . Form1. . (Project) (Properties).

.2

, , . , . (RunTime). . , Caption. (Form) Caption , (Label) .

VB QBasic, ( 1). : QBasic, , , , , , . VB , . ( Vscroll Hscpoll), , . 3.

.3.

, , Properties, . , , . , (.4), .

.4.

, form1.frm .

RunStart F5. RunEnd.

VB

( 1), , :

(HScroll);

(VScroll);

.

HScroll (Properties-HScroll). , 15000 , 15000 . MAX 32767 15000 (.5). MousePointer 7-Size NS. F5.

, . Label . . Project1 ( ). : Private Sub HScroll1_Change() End Sub :

Label1 = HScroll1

Cls

X1 = Label1 * 0.55 + 500

Line (X1, 4300)-(X1 + 100, 4450), 11, BF

. 6.

. 5.

. 6.

1 HScroll. :

X1 = Label1 * 0.55 + 500

, , (0,55 500) .

CLS HScroll.

(VScroll). Label 2. VScroll (Properties-VScroll) MAX Value 80, 80 . Mouse Pointer 9-Size WE. VScroll1, Label2 0, , Properties VScroll1 :

Private Sub VScroll1_Change()

Label2 = 80 - VScroll1

End Sub

. 7.

. 7.

, (, ). Command1 . Properties-Command1 Caption Start. Command1 , QBasic ( 1), :

Private Sub Command1_Click()

x0 = 480

y0 = 4440

X2 = x0

Y2 = y0

v = 150

g = 9.8

a = Label2

f = a * 3.14 / 180

100 q = 0.0001

t = t + q

s = v * t * Cos(f) * 2

h = (v * t * Sin(f) - (g * t ^ 2) / 2) * 5.5

Line (X2, Y2)-(x0 + s, y0 - h), 14

X2 = x0 + s

Y2 = y0 - h

If h < 0 Then GoTo 200

GoTo 100

200 End Sub

0 0 ( ) .

, , . .8 .9 .

, , . , 2 form*.frm , , . 10 . 11 .

. 8.

. 9

. 10

. 11

VB

. VB - , , , , , - .

( 3), () . , . VB . . 12.

.12.

, , , , , , :

Private Sub Form_Load()

Label1.Caption = 0

Label2.Caption = 0

Label3.Caption = 0

Label4.Caption = 0

Label5.Caption = 0

Label6.Caption = 0

Label13.Caption = 0

Label15.Caption = 0

Label17.Caption = 0

End Sub

(Private Sub Timer1_Timer()), , Timer1 interval 1, 1.. () :

Label1.Caption = Label1.Caption + Timer1.Interval

a = Label1.Caption

Timer1 13000 :

If X0 > 13000 Then Timer1.Interval = 0

If Label17.Caption < 150 Then Timer1.Interval = 0

, .. interval 0.

3 :

Private Sub Command1_Click()

Rem

Timer3.Interval = 1

End Sub

:

T = Timer3.Interval

Rem

X1 = V * T * Cos(f - Rnd * 0.1)

Y1 = V * T * Sin(f + Rnd * 0.1)

Label5.Caption = (Label5.Caption + X1)

Label4.Caption = (Label4.Caption + Y1)

Label6.Caption = 12000 - a * k

X0 = Label5.Caption

Y0 = -Label4.Caption

+25 -15. , , : max 40; value 10.

:

Label3.Caption = (25 - VScroll1)

, Label3.Caption =15.

2 , -50, .. :

If Y0 > 50 Then Timer2.Interval = 1,

:

Private Sub Timer2_Timer()

Rem:

Rem: a

Rem: r , n

Rem: 1 4

X1 = Label5.Caption

Y1 = -Label4.Caption

r = 200

n = 500

Dim x(10), y(10)

Randomize (Label2.Caption)

For i = 1 To 2

a = -6.28 * Rnd / 2

rn = r * Rnd

xc = X1 + 400 + rn * 1.5 * Cos(a)

yc = Y1 + 5600 + rn * 5 * Sin(a)

PSet (xc, yc), &HFFFF80 * Rnd + &HC0C0FF * Rnd

Next

If Label1.Caption > 200 Then Timer2.Interval = 0

End Sub

3 -100:

If Y0 > 100 Then Timer3.Interval = 0

:

If Label5.Caption > 11500 - (Label1.Caption) Then Timer4.Interval = 1

4. , 200 5:

Private Sub Timer4_Timer()

If Label4.Caption < 200 Then Timer5.Interval = 1

End Sub

:

Private Sub Timer5_Timer()

X0 = Label5.Caption

Y0 = -Label4.Caption

r = 100

n = 100

Dim x(100), y(100)

Randomize (Label2.Caption)

For i = 1 To 5

a = -6.28 * Rnd / 2

rn = r * Rnd

xc = X0 + 400 + rn * 3 * Cos(a)

yc = Y0 + 5600 + rn * 5 * Sin(a)

PSet (xc, yc), &HFFFF80 * Rnd + &HC0C0FF * Rnd

Next

End Sub

, 1 :

If Label17.Caption < 150 Then Timer1.Interval = 0

(.13).

.13

, Visual Basic, , . VB, Windows, , .

, , Windows.

, , .

. . . 9 . 2005 30 .

. ., . . IBM: . . .: , 1991. 30 .: .

. . : . ./ ..; . . . . .: . ., 1989. 272 .: .

: . / . . . . . 2. / .., .. . 2- ., . .: . ., 1989-112 .: .

. . ., . . . . 10 .: . . . .: , 2002.

. . , . . . . . , . ., , 1972 96 .:

. . . . : -. .

http://www.codenet.ru/progr/vbasic/first.php

http://vb.hut.ru/vbnovice/lessons.htm

http://vbzero.narod.ru/loading.htm

http://vbzero.narod.ru/site.htm

http://vbzero.narod.ru/project.htm

http://www.tam.ru/guide/

http://www.codenet.ru/progr/vbasic/menu/vbhelp_01.php

1

REM

5 INPUT 5 80 ; a

7 IF a < 5 THEN 10

IF a > 80 THEN 20

GOTO 40

10 INPUT >=5; a

GOTO 7

20 INPUT <=80; a

GOTO 7

40 INPUT 200 5000 ; l

45 IF l < 200 THEN 50

IF l > 5000 THEN 60

GOTO 70

50 INPUT >=200; l

GOTO 45

60 INPUT <=5000; l

GOTO 45

70 INPUT F1; enter

REM

SCREEN 9:

x0 = 50

y0 = 300

x1 = 600

y1 = 50

x2 = 50

y2 = 300

REM Y

LINE (x0, y0)-(x0, y1), 12

LOCATE 18, 4: PRINT 250

LOCATE 14, 4: PRINT 500

LOCATE 10, 4: PRINT 750

LOCATE 6, 4: PRINT 1000

LINE (48, 245)-(52, 245), 11

LINE (48, 190)-(52, 190), 11

LINE (48, 135)-(52, 135), 11

LINE (48, 80)-(52, 80), 11

REM X

LINE (x0, y0)-(x1, y0), 12

LOCATE 23, 19: PRINT 1000

LOCATE 23, 31: PRINT 2000

LOCATE 23, 44: PRINT 3000

LOCATE 23, 56: PRINT 4000

LOCATE 23, 69: PRINT 5000

LINE (150, 302)-(150, 298), 11

LINE (250, 302)-(250, 298), 11

LINE (350, 302)-(350, 298), 11

LINE (450, 302)-(450, 298), 11

LINE (550, 302)-(550, 298), 11

REM

LINE (x0 + l / 10, 299)-(x0 + l / 10 + 5, 299), 10

LINE (x0 + l / 10, 298)-(x0 + l / 10 + 5, 298), 10

REM

LOCATE 1, 6: PRINT V m/s

LOCATE 2, 6: PRINT H m

LOCATE 2, 24: PRINT S m

LOCATE 1, 24: PRINT T s

80 KEY(1) ON

ON KEY(1) GOSUB 90

GOTO 80

REM

90 v = 200

g = 9.8

f = a * 3.14 / 180

100 q = .01

t = t + q

REM k

k = .016

vs = v * COS(f) (k k / (k + v * COS(f)))

vh = v * SIN(f) (k k / (k + v * SIN(f)))

s = vs * t * 2

h = (vh * t (g * t ^ 2) / 2) * 5.5

v = SQR(vs ^ 2 + vh ^ 2)

LINE (x2, y2)-(x0 + s / 20, y0 h / 25), 14

x2 = x0 + s / 20

y2 = y0 h / 25

LOCATE 1, 12: PRINT v

LOCATE 2, 12: PRINT h / 5.5

LOCATE 2, 28: PRINT s / 2

LOCATE 1, 28: PRINT t

IF h < 0 THEN 200

GOTO 100

200 REM

r = 30

n = 500

REM: a

REM: r , n

REM: 0.5 1

DIM x(n), y(n)

RANDOMIZE (TIMER)

FOR I = 1 TO n

a = -6.28 * RND / 2

rn = r * RND

xc = x2 + rn * .5 * COS(a)

yc = y2 + rn * 1 * SIN(a)

PSET (xc, yc), 9 + 9 * RND

PRESET (x(i), y(i))

NEXT

END

2

VERSION 5.00

Begin VB.Form Form1

BackColor = &H8000000D&

BorderStyle = 1 Fixed Single

Caption = Form1

ClientHeight = 7770

ClientLeft = 45

ClientTop = 435

ClientWidth = 8670

FillColor = &H00C0FFFF&

LinkTopic = Form1

MaxButton = 0 False

MinButton = 0 False

ScaleHeight = 7770

ScaleWidth = 8670

StartUpPosition = 3 Windows Default

Begin VB.CommandButton Command1

Caption =

Height = 495

Left = 720

TabIndex = 2

Top = 5280

Width = 1215

End

Begin VB.VscrollBar Vscroll1

Height = 1935

Left = 240

Max = 80

MousePointer = 9 Size W E

TabIndex = 1

TabStop = 0 False

Top = 2400

Value = 80

Width = 255

End

Begin VB.HscrollBar Hscroll1

Height = 255

Left = 240

Max = 15000

Min = 10

MousePointer = 7 Size N S

TabIndex = 0

Top = 4800

Value = 100

Width = 8295

End

Begin VB.Label Label9

Caption =

Height = 375

Left = 2160

TabIndex = 11

Top = 5400

Width = 975

End

Begin VB.Line Line1

X1 = 600

X2 = 600

Y1 = 4680

Y2 = 480

End

Begin VB.Label Label8

Caption = 0

Height = 375

Left = 3120

TabIndex = 10

Top = 5400

Width = 1095

End

Begin VB.Label Label7

Caption =

Height = 375

Left = 2160

TabIndex = 9

Top = 5880

Width = 975

End

Begin VB.Label Label6

Caption = ()

Height = 375

Left = 4800

TabIndex = 8

Top = 5880

Width = 975

End

Begin VB.Label Label5

Caption = ()

Height = 375

Left = 4800

TabIndex = 7

Top = 5400

Width = 975

End

Begin VB.Label Label4

Caption = Label4

Height = 15

Left = 5040

TabIndex = 6

Top = 6000

Width = 135

End

Begin VB.Label Label3

BackColor = &H80000018&

Caption = 0

Height = 375

Left = 3120

TabIndex = 5

Top = 5880

Width = 1095

End

Begin VB.Label Label2

BackColor = &H80000018&

Caption = 0

Height = 375

Left = 5760

TabIndex = 4

Top = 5880

Width = 1095

End

Begin VB.Label Label1

BackColor = &H80000018&

Caption = 0

Height = 375

Left = 5760

TabIndex = 3

Top = 5400

Width = 1095

End

Begin VB.Line Line2

X1 = 600

X2 = 8400

Y1 = 4680

Y2 = 4680

End

End

Attribute VB_Name = Form1

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Private Sub Hscroll1_Change()

Cls

Label1 = Hscroll1

X1 = Hscroll1 * 0.507

Line (X1 + 550, 4500)-(X1 + 600, 4650), &HC0FFFF, BF

End Sub

Private Sub Vscroll1_Change()

Label2 =80 Vscroll1

End Sub

Private Sub Command1_Click()

X0 = 600

Y0 = 4680

X2 = X0

Y2 = Y0

v = 300

g = 9.8

a = Label2

f = a * 3.14 / 180

100 q = 0.00005

t = t + q

Rem k

k = 0.0001

vs = v * Cos(f) (k k / (k + v * Cos(f)))

vh = v * Sin(f) (k k / (k + v * Sin(f)))

s = vs * t

h = (vh * t (g * t ^ 2) / 2)

s = v * t * Cos(f)

h = v * t * Sin(f) (g * t ^ 2) / 2

v = Sqr(vs ^ 2 + vh ^ 2)

Line (X2, Y2)-(X0 + s, Y0 h), &HFF&

X2 = X0 + s

Y2 = Y0 h

If h < 0 Then GoTo 200

GoTo 100

200 Label3 = s * 4.32 1

v = X1 2 * 2

Label8 = Hscroll1 s * 4.32 1

End Sub

3

Private Sub Form_Load()

Label1.Caption = 0

Label2.Caption = 0

Label3.Caption = 0

Label4.Caption = 0

Label5.Caption = 0

Label6.Caption = 0

Label13.Caption = 0

Label15.Caption = 0

Label17.Caption = 0

End Sub

Private Sub Timer1_Timer()

Label1.Caption = Label1.Caption + Timer1.Interval

Label2.Caption = Label2.Caption + Timer2.Interval

Label13.Caption = Label13.Caption + Timer3.Interval

Label15.Caption = Label15.Caption + Timer4.Interval

Label17.Caption = Label17.Caption + Timer5.Interval

a = Label1.Caption

T = Timer3.Interval

k = 1.2

V = 30

Label3.Caption = (250 - VScroll1) 10

q = Label3.Caption

f = q * 3.14 / 180

Rem

Line (14850, 5640)-(350, 5820), &H80000002, BF

Rem

Line (12000 - a * k, 5620)-(12850 - a * k, 5520), &HFFFF&, BF

Line (11920 - a * k, 5540)-(12000 - a * k, 5530), &HFFFF&, BF

Line (11900 - a * k, 5550)-(12000 - a * k, 5540), &HFFFF&, BF

Line (11920 - a * k, 5560)-(12000 - a * k, 5550), &HFFFF&, BF

Line (11940 - a * k, 5570)-(12000 - a * k, 5560), &HFFFF&, BF

Line (11950 - a * k, 5590)-(12000 - a * k, 5570), &HFFFF&, BF

Line (11970 - a * k, 5600)-(12000 - a * k, 5590), &HFFFF&, BF

Line (12825 - a * k, 5600)-(12900 - a * k, 5580), &H8000000F, BF

Line (12800 - a * k, 5620)-(12900 - a * k, 5600), &H8000000F, BF

Line (12850 - a * k, 5620)-(13950 - a * k, 5520), &H8000000F, BF

Rem

Line (12200 - a * k, 5440)-(12650 - a * k, 5500), &HFFFF&, BF

Line (11900 - a * k, 5460)-(12200 - a * k, 5460), &HFFFF&

Line (12650 - a * k, 5440)-(12750 - a * k, 5500), &H8000000F, BF

Rem

X1 = V * T * Cos(f - Rnd * 0.1)

Y1 = V * T * Sin(f + Rnd * 0.1)

Label5.Caption = (Label5.Caption + X1)

Label4.Caption = (Label4.Caption + Y1)

Label6.Caption = 12000 - a * k

X0 = Label5.Caption

Y0 = -Label4.Caption

Rem

Line (X0 + 300, 5550 + Y0)-(X0 + 400, 5500 + Y0), &H8000000F, BF

Line (X0 + 300, 5550 + Y0)-(X0 + 500, 5600 + Y0), &H8000000F, BF

Line (X0 + 300, 5450 + Y0)-(X0 + 550, 5500 + Y0), &H8000000F, BF

Line (400 + X0, 5500 + Y0)-(420 + X0, 5550 + Y0), &HFF&, BF

Line (400 + X0, 5525 + Y0)-(550 + X0, 5525 + Y0), &HFF&

Rem

X2 = 12820 - a * k

Y2 = 5620

r = 30

n = 1

Dim x(10), y(10)

Randomize (Label1.Caption)

For i = 1 To 50

a = -6.28 * Rnd / 6

rn = r * Rnd

xc = X2 + rn * 9 * Cos(a)

yc = Y2 + rn * 3 * Sin(a)

PSet (xc, yc), &HFFFF80 * Rnd + &HC0C0FF * Rnd

Next

If X0 > 13000 Then Timer1.Interval = 0

If Y0 > 50 Then Timer2.Interval = 1

If Y0 > 100 Then Timer3.Interval = 0

If Label5.Caption > 11500 - (Label1.Caption) Then Timer4.Interval = 1

End Sub

Private Sub Command1_Click()

Rem

Timer3.Interval = 1

End Sub

Private Sub Timer2_Timer()

Rem:

Rem: a

Rem: r , n

Rem: 1 4

X1 = Label5.Caption

Y1 = -Label4.Caption

r = 200

n = 500

Dim x(10), y(10)

Randomize (Label2.Caption)

For i = 1 To 2

a = -6.28 * Rnd / 2

rn = r * Rnd

xc = X1 + 400 + rn * 1.5 * Cos(a)

yc = Y1 + 5600 + rn * 5 * Sin(a)

PSet (xc, yc), &HFFFF80 * Rnd + &HC0C0FF * Rnd

Next

If Label1.Caption > 200 Then Timer2.Interval = 0

End Sub

Private Sub Timer4_Timer()

If Label4.Caption < 200 Then Timer5.Interval = 1

End Sub

Private Sub Timer5_Timer()

X0 = Label5.Caption

Y0 = -Label4.Caption

r = 100

n = 100

Dim x(100), y(100)

Randomize (Label2.Caption)

For i = 1 To 5

a = -6.28 * Rnd / 2

rn = r * Rnd

xc = X0 + 400 + rn * 3 * Cos(a)

yc = Y0 + 5600 + rn * 5 * Sin(a)

PSet (xc, yc), &HFFFF80 * Rnd + &HC0C0FF * Rnd

If Label17.Caption < 150 Then Timer1.Interval = 0

Next

End Sub



2005 - 2006 . 10 1 2006 . Visual Basic

 

 

 

! , , , .
. , :