.


:




:

































 

 

 

 


VB




 

VB :

Form,

Picture Box.

. (x,y), x , y . x , y -

x y x y , .

ScaleMode

0 User , ( ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight . )
1 Twip . . 1440 .
2 Point . 72 .
3 Pixel . .
4 Character . 1/6 1/12 .
5 Inch .
6 Millimeter .
7 Centimeter .

ScaleLeft x .

ScaleTopt y .

ScaleWidth .

ScaleHight .

ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight , ., , Picture1 y=sin(x) x 0 6,28 y 1 +1 :

Picture1.ScaleLeft=0

Picture1.ScaleTop=+1

Picture1.ScaleWidth=6,28

Picture1.ScaleHight=-2

(0,0), .


 

2 , :

BackColor , .

ForeColor - , . , .

VB, : vbRed - , vbGreen ..

, , Picture1

Picture1.BackColor=vbYellow

Picture1.Cls

Picture1.ForeColor=vbWhite

Pictire.Line (0,0)-(100,100)

 

 

Cls
Pset ()
Point ()
Line ,
Circle ,
PaintPicture

Cls , ( BackColor):

[ object ]. Cls

object , .

, Picture1 :

Picture1.BackColor=vbBlack

Picture1.Cls

 

Pset :

[ object ].Pset (x,y) [, color ]

x y , .

color , ( ForeColor).

, x=100, y=200 Picture1:

Picture1.Pset (100,200), vbBlue

Line (x1,y1) (x2,y2):

Line (x1,y1) (x2,y2) [, color ]

(x2,y2):

Line (x2,y2) [, color ]

x1,y1,x2,y2 , .

color , ( ForeColor).

, (x=100, y=200) (x=300, y=400) Picture1:

Picture1.Line (100,200) (300,400), vbCyan

 

2.1 Satm5.

2.2 frmSa:

Project Explorer frmSa,

( Command1),

2.1:

2.1

Command1 Name CmdGrph
  Caption &Graph
  Font** Arial, () Bold,12
  MousePoiter NoDrop
  TabIndex  

2.3 3:

Project Explorer , frmSa,

Project,

Add Form. Add Form New Form,

Add Form Open. , , Form1.

2.4 4 5 . 2.2.

2.5 Form1, Form2 Form3 2.2. Project Explorer.

2.2

Form1, Form3, Form2 Height  
  Width  
  Top  
  BoderStyle 1- Fixed Single
Form1 Name frmGrph1
  Caption
Form2 Name frmGrph2
  Caption
Form3 Name frmGrph3
  Caption

 

2.6 :

Project Explorer , frmSa,

File,

Save File As:

ü , Z:,

ü satm6-1, Save ,

Project Explorer frmTabl,

ü satm6-2,

frmGrph1, frmGrph2 frmGrph3 satm6-3 satm6-4 satm6-5.

File,

Save Project As,

Save Project As satm6 ( satm5) Save

 

2.7 frmGrph1:

Project Explorer frmGrph1,

Command1, Command2 Command3,

2.3:

2.3

Font** Arial, () Bold,11
  MousePoiter NoDrop
Command1 Name CmdCnl
  Caption &Cancel
  Cancel True
  TabIndex  
Command2 Name CmdNxt
  Default True
  Caption &Next
  TabIndex  
Command3 Name CmdExt
  Caption &Exit
  TabIndex  

 

2.7 frmGrph2 frmGrph3

Project Explorer frmGrph2,

. 2.6,

.

 

2.8 Graph frmSa:

Project Explorer frmSa,

Graph

Private Sub cmdGrph_Click( )

FrmGrph1.Show

Me.Hide

 

2.9 frmGrph1:

Project Explorer frmGrph1,

Cancel

Private Sub cmdCnl_Click()

End

Next

Private Sub cmdNxt_Click()

FrmGrph2.Show

Me.Hide

Exit

Private Sub cmdExt_Click()

frmSa.Show

Me.Hide

2.10 frmGrph2 frmGrph3 ( 2.8 ).

 

2.11

VB5.0,

Graph Enter frmGrph1,

Next . frmGrph2,

Next Enter. frmGrph3 .

Esc. , .

 

2.11 frmGrph1 ( Y 0 15000 , - X 10000 110000 ).

Project Explorer frmGrph1,

frmGrph1 View Object Object Explorer ( ),

PictureBox Toolbox ( ),

frmGrph1 ,

:

Name PctP_h
ScaleMode 0 User
ScaleLeft  
ScaleTop  
ScaleWidth  
ScaleHight -15000
AutoRedraw True

:

0

15 ,

10000 ,

110000 ,

( , , , ),

Save VB.

 

2.12 frmGrph2 ( Y 0 15000 , - X 0,2 1,25).

Project Explorer, frmGrph2, ,

PictureBox Toolbox frmGrph2 ,

:

 

Name PctR_h
ScaleMode 0 User
ScaleLeft 0,2
ScaleTop  
ScaleWidth 1,05
ScaleHight -15000
AutoRedraw True

 

:

0

15 ,

0,2,

1,25,

( , , , ),

Save VB.

 

2.13 frmGrph3 ( Y 0 15000 , / - X 200 350).

Project Explorer, frmGrph3, ,

PictureBox Toolbox frmGrph3 ,

:

 

 

Name PctA_h
ScaleMode 0 User
ScaleLeft  
ScaleTop  
ScaleWidth  
ScaleHight -15000
AutoRedraw True

/:

0

15 ,

200,

350,

( , , , ),

Save VB.

 

2.14

VB5.0,

Graph Enter frmGrph1 ,

Next . frmGrph2 ,

Next Enter. frmGrph3 /,

Esc. , .

 

2.15 . gsngSa(), ( Table frmSa. :

gsngSa(1,) -

gsngSa(2,) -

gsngSa(3,) -

gsngSa(4,) -

gsngSa(5,) -

= 1,2,, n n gshgSa(), Ubound, :

n = Ubound(gsngSa,2)-1

gsngSa frmSa , - Graph frmSa.

:

Private Sub CmdGrph_Click()

Dim k As Integer

' ,

FrmGrph1.PctP_h.Cls ' 1

FrmGrph1.PctP_h.ForeColor = vbGreen ' 1 -

FrmGrph2.PctR_h.Cls ' 2

FrmGrph2.PctR_h.ForeColor = vbRed ' 2 -

FrmGrph3.PctA_h.Cls ' 3

FrmGrph3.PctA_h.ForeColor = vbYellow ' 3 -

FrmGrph1.PctP_h.PSet (gsngSa(2, 1), gsngSa(1, 1)) '
' 1

FrmGrph2.PctR_h.PSet (gsngSa(3, 1), gsngSa(1, 1)) '
' 2

FrmGrph3.PctAh.PSet (gsngSa(4, 1), gsngSa(1, 1)) '
' 3

For k = 2 To UBound(gsngSa, 2)-1 '
' gsngSa

FrmGrph1.PctP_h.Line -(gsngSa(2, k), gsngSa(1, k)) '
' 1

FrmGrph2.PctR_h.Line -(gsngSa(3, k), gsngSa(1, k)) '
2

FrmGrph3.PctA_h.Line -(gsngSa(4, k), gsngSa(1, k)) '
' 3

Next k

'

FrmGrph3.PctA_h.ForeColor = vbCyan ' 4 -

FrmGrph3.PctA_h.PSet (gsngSa(5, 1), gsngSa(1, 1)) '
' 4

For k = 2 To UBound(gsngSa, 2)-1 '
' gsngSa

FrmGrph3.PctA_h.Line -(gsngSa(5, k), gsngSa(1, k)) '
' 4

Next k

Me.Hide

FrmGrph1.Show '
'

End Sub

 

2.16 Graph frmSa:

Project Explorer frmSa,

Graph

Private Sub cmdGrph_Click() , . 2.15. .

Save VB.

2.17 .

2.18

VB5.0

0 15000 1000

OK

Table

Graph

, Next

, :

,

.

2.19 .

2.20 , .

2.31

 





:


: 2016-11-12; !; : 491 |


:

:

- , 20 40 . - .
==> ...

1600 - | 1559 -


© 2015-2024 lektsii.org - -

: 0.102 .