2011
658(076)
83
: .., ϲ
: ... ..
'
-
___ ______201_ .
" ", Visual Basic; Mathcad
. , . , , .
" " , . ᒺ- Visual Basic Mathcad.
. .
Visual Basic .
Mathcad. . .
1 Word
: Word; ; .
, .
, , `, ` .
, , , ` . ` `.
, .
1 . -. () - ` , (). " ". , , , . . ³ 3 , 5 . 10, 15, 20 . , 5. b 1,5 .
|
|
1
, ().
, ().
. , "", ""
,
→ .
1. : ( 40) 2- . . 1 3. 2 . 2 .
: : ; ; ; ; ∆; ; ∑; L (); L ( ); JT2 ( ); Rz; T; P∑..
:
:
) 2*Zi min=2*(Rz+T+P∑)
) 2*Zi min=2*(Rz+T+P∑)
) 2*Zi min=2*(Rz+T+P∑)
) 2*Zi min=2*(Rz+T+P∑)
г , .
:
Z0 max=∑Zmax
Z0 min=∑Zmin
2. .
1. , .
2. .
3. ³
1. .
2.
2 Word
: Word; ; .
|
|
1. y=ax2+bx+c
:
.
, .
: , b, . , , , b, 0. , . , , , " ", , , .
1. ,
: , y .
: -1 ln(x), 1 cos(x), sin(x).
.
1. , .
2. ³ .
3. , .
: Visual Basic; ; .
, , 䳿: , , (Label). ϳ . . ' , . , , . . , , , Timer. , .
Properties. , , . - Properties Caption. , , " ". .
. Start, . ' ! , .
Save Project.
1. " !!"!
VB " !!"!. , " !!"!. Exit (. 3.1). :
|
| ||||
|
3.1
. TextBox, . TextBox Text . BackColor . Font . Caption Command1 - , Command2 - , Command3 - . Font .
|
|
1. :
Private Sub Command1_Click()
Text1.Text = " !!!"
End Sub
, 1 3 2 .
2. :
Private Sub Command2_Click()
Text1.Text = " "
End Sub
3. :
Private Sub Command3_Click()
End
End Sub
(F5) .
2. Select Case. " "
1. , 3.2
|
|
|
3.2
: , , ' - (Label1 - Label4). - ListBox1. Label4 - . - ( - Command1).
2. . Code ' Form_Load.
:
Private Sub Form_Load()
List1.AddItem "England"
List1.AddItem "Germany"
List1.AddItem "Spain"
List1.AddItem "Italy"
List1.AddItem ""
End Sub
AddItem. List_Click. :
Private Sub List1_Click()
Label3.Caption = List1.Text
Select Case List1.ListIndex
Case 0
Label4.Caption = "Hello, Programmer!"
Case 1
Label4.Caption = "Hello, Programmierer!"
Case 2
Label4.Caption = "Hello, Programador!"
Case 3
Label4.Caption = "Hello, Programmator!"
Case 4
Label4.Caption = ", !"
End Select
End Sub
3. - End.
. .
3. Select Case, " ".
, 3.3
3.3
. " ", - " ", . List1 "ʳ"!. ϳ Command1 :
Private Sub Command1_Click()
End
End Sub
:
Private Sub Form_Load()
List1.AddItem ""
List1.AddItem ""
List1.AddItem ""
List1.AddItem ""
List1.AddItem ""
List1.AddItem ""
List1.AddItem ""
End Sub
List1 :
Private Sub List1_Click()
Label2.Caption = List1.Text
Select Case List1.ListIndex
Case 0
Label3.Caption = ", , "
|
|
Case 1
Label3.Caption = ", ., -"
Case 2
Label3.Caption = ", , "
Case 3
Label3.Caption = ", "
Case 4
Label3.Caption = ", "
Case 5
Label3.Caption = " "
Case 6
Label3.Caption = ""
End Select
End Sub
. ' .
1. ³ .
2.
4.
: ; ; .
1. Visual Basic.
' . ' :
1) , ( , .;
2) , ( , .);
3) , ( , .)
Visual Basic Line (), . , .
, , (.4.1).
4.1
:
Private Sub Form_Load()
Text1 = Line1.X1
Text2 = Line1.X2
Text3 = Line1.Y1
Text4 = Line1.Y2
End Sub
Private Sub Command1_Click()
Line1.X1 = Val(Text1)
Line1.X2 = Val(Text2)
Line1.Y1 = Val(Text3)
Line1.Y2 = Val(Text4)
End Sub
, (x1, y1, x2, y2) , , "", - .
. , , , . . , . 4.1. (. 4.2), : (Label) -" 1=", " 2=", " 3=", "Y 1=", "Y 2=", "Y 3"; Text1, Text2. Text6; Command1 "". ( - ).
4.2
Private Sub Command1_Click()
Line1.X2 = Val(Text1)
Line2.Y1 = Val(Text2)
Line2.X1 = Val(Text1)
Line1.Y2 = Val(Text2)
Line3.X1 = Val(Text3)
Line3.Y1 = Val(Text4)
Line1.X1 = Val(Text3)
Line1.Y1 = Val(Text4)
Line2.X2 = Val(Text5)
Line2.Y2 = Val(Text6)
Line3.X2 = Val(Text5)
Line3.Y2 = Val(Text6)
End Sub
:
Private Sub Form_Load()
Text1 = Line1.X2
Text2 = Line2.Y2
Text3 = Line3.X1
Text4 = Line1.Y1
Text5 = Line3.X2
Text6 = Line3.Y2
End Sub
, . , "" , . , 8.
2.
. " " - , ( , - ). , (, , / .). (, !) , . , , 10 " "! , / .
Timer (). Timer ().
1.Name ' .
2. Interval , .
. . -, MS Paint (. 4.3) korablik.bmp ( ).
|
|
4.3
-, , . Timer Image (). Image, (korablik.bmp). Picture () . F5. , 4.4.
4.4
"" . , , . ³, . Left ( ). , . Timer (), . Timer1, :
Private Sub Timer1_Timer()
Image1.Left=Image1.Left+30
End Sub
- Interval () Timer1 () 100 (). Left, ( ) . , .
1. ³ .
2.
5. ,
: ; ; .
1. ""
䳿 , , , . , , . "" 5.1.
1 (Label1), Caption - 1; c 2 (Label2), Caption - 2. ϳ 1 2, , 2 (Text1, Text2).
5.1
O Frame () 1/3 . Option Button, Caption (+), 3 Caption - ³(-), (*), (/).
3 (Label3) , 4 (Label4) Caption. , , 2 Command Button - . Command1 . :
Private Sub Command1_Click()
Dim First, Second
First = Val(Text1.Text)
Second = Val(Text2.Text)
If Option1.Value = True Then
Label4.Caption = First + Second
End If
If Option2.Value = True Then
Label4.Caption = First - Second
End If
If Option3.Value = True Then
Label4.Caption = First * Second
End If
If Option4.Value = True Then
Label4.Caption = First / Second
End If
End Sub
Private Sub Command2_Click()
End
End Sub
First, Second. 2 . Val. If Value () True (), Then () , ' 4. : If.Then Caption () ' Label4 ( ).
. , : (Integer Division) - (\), (Remainder) d, (Exponentiation) ^, (Concatenation) &.
2. г .
(. 1), . : axx+bx+c=0, .
5.2
, (. 5.2):
1) ("a=", "b=", "c=", "x 1=", "x 2=" " , );
2) Text1, Text2. Text5;
3) "".
, - , . ³ X1, X2 Variant, - (, ), (), ( , - , ). Double - .
General :
Option Explicit
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As Double
Dim x1 As Variant
Dim x2 As Variant
Private Sub Command1_Click()
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
If a = 0 Then
If b <> 0 Then
x1 = -c / b
x2 = x1
Else
If c = 0 Then
x1 = " "
x2 = x1
Else
x1 = " "
x2 = x1
End If
End If
Else
d = b * b - 4 * a * c
If d > 0 Then
d = Sqr(d)
x1 = (-b + d) / 2 * a
x2 = (-b - d) / 2 * a
Else
If d = 0 Then
x1 = -b / 2 *a
x2 = x1
Else
x1 = " "
x2 = x1
End If
End If
End If
Text4 = x1
Text5 = x2
End Sub
, ( ).
1. ³ .
2. .
6. IfThen
: ³ , ; ; .
1. If.Then
2 , , , (Label) (. 6.1). "" , 7, ' . "ʳ" .
1. (Command Button Control):
Command1. Ҳ Caption "".
ommand2. Ҳ Caption "ʳ".
2. 4 (Label Control), 6.1.
(Label1 3) . Ҳ Alignment () 2 .
6.1
Border Style ( ) 1 (Fixed Single) - . Font () Arial, 24, . Caption 1-3.
4 (Label4) Caption " ", Font Arial, 20, . FareColor System , Appearance () Palette ( ). .
3. (Image Control). (.wmf - - ', - ). 3 : Stretch () ; Picture () ; Visible (), . Strech True (). Picture 2 Load Picture . Visible False () .
4. "ʳ" :
Private Sub Command2_Click()
End
End Sub
5. "" :
Private Sub Command1_Click()
Image1.Visible=False
Label1.Caption=int(rnd*10)
L abel2.Caption=int(rnd*10)
Label 3.Caption=int(rnd*10)
if (Label1.Caption=7)or(Label2.Caption=7)or(Label3.Caption=7) Then
Image1.Visible=True
end if
End Sub
rnd 0 1, int 10 . . , 7 , , .
2. .
3 ' , ' (. 6.2).
6.2
1. DriveListBox control ( ) . . . : Dir1.Path=Drive1.Drive.
2. DirListBox control ( ). . : File1.Path=Dir1.Path
3. FileListBox control ( ). . Pattern - *.bmp;*.wmf;*.ico;*.pcx. :
Image1.Picture=LoadPicture(File1.Path+"\"+File1.FileName)
4. Image Control ( ). Stretch - True; BorderStyle - 1 - Fixed Single.
5. .
1. ³ .
2.
7. Line (³) Shape (Գ)
: ³ Visual Basic; ; .
1. Line(³) Shape(Գ).
Visual Basic .
1. Label (. 7.1). Caption OOO "Kardif". Fore Color ( ) , Font () 26.
2. Line , 7.1. Border Width () - 5, Border Color () .
3. .
7.1
4. Shape (Գ) . FullStyle ( ) .
5. Shape (Գ) , . :
' | ||
Shape1 | Shape (Գ) | 0 - 0 - Rectangle() |
FullColor ( ) | ||
FullStyle ( ) | 6 - Cross () | |
BorderColor ( ) | ||
Shape2 | Shape (Գ) | 4 - Rounded Rectangle ( , ) |
FullColor ( ) | ||
FullStyle ( ) | 6 - Cross () | |
BorderColor ( ) |
6. . Label2: Caption " , , ", Font , 14, Aligment (1 Right Justify) .
7. 2 . Quit End.
8. Caption " ". .
1. ³ .
2.
8.
: ; ; .
1. .
1. Timer. ' . Label, 8. 1.
8.1
:
' | ||
Label1 | Caption | |
Font | Times New Roman, Bold, 24 | |
Aligment | 2 - Center | |
Timer1 | Interval | |
Enabel | True | |
Form1 | Caption | Digital Clock |
, Picture ' Form .
2. ' Timer
Label1.Caption=Time
3. .
2. .
1. ³ . 8.2.
2. : Text Box, Label, Command Button, Timer.
8.2
:
' | ||
Text1 | Text | |
Password Char | *(*( ) | |
Label1 | Caption | Enter your password within 15 seconds |
Command1 | Caption | Try Password |
Timer1 | Interval | |
Enabled | True | |
Password | Form1 | Caption |
' Timer :
Private Sub Timer1_Timer()
MsgBox ("Sorry, Your time is up")
End
End Sub
' Comand :
Private Sub Command1_Click()
If Text1.Text = "secret" Then
Timer1.Enabled = False
MsgBox ("Welcome to the system")
End
Else MsgBox ("Sorry, friend, I don't know you")
End If
End Sub
, Secret. , , . , , . 15 . . .
1. ³ .
2.
9.
: ; ; .
1. Y=3*x2 [- 5, 5]
(. 9.1)
9.1
:
Private Sub Command1_Click()
Picture1.Scale (-10, 15)-(10, -15)
For i = -10 To 10
Picture1.Line (i, -15)-(i, 15), RGB(200, 220, 225)
Picture1.PSet (i, 0)
Picture1.Print i
Next
For i = -5 To 5
Picture1.Line (-10, i)-(10, i), RGB(200, 220, 225)
Picture1.PSet (0, i)
Picture1.Print i
Next
Picture1.Line (-10, 0)-(10, 0), QBColor(8)
Picture1.Line (0, -15)-(0, 15), QBColor(8)
For x = -3 To 3 Step 0.01
y = 3 * x ^ 2
Picture1.PSet (x, y), vbgreen
Next
Next
End Sub
2.
1. | =2*3 [-8;8] |
2. | y=2*3 - 4 [-6;6] |
3. | y=-x2+5 [-7;7] |
4. | y=-x3-2 [-5;5] |
5. | y=cos(x) [-π; π] |
6. | y=sin(x) [-π; π] |
7. | y=-x+5 [-8;8] |
8. | y= [-5;5] |
9. | y= [-6;6] |
10. | y=2*3-1 [-7;7] |
11. | y=-x-2 [-8;8] |
12. | y=-x2+4 [-7;7] |
1. ³ .
2.
11
: