£·¼µ¹ƒµ¹‚ Visual Basic-2012-13-½µ

download £·¼µ¹ƒµ¹‚ Visual Basic-2012-13-½µ

of 26

  • date post

    11-Feb-2018
  • Category

    Documents

  • view

    215
  • download

    0

Embed Size (px)

Transcript of £·¼µ¹ƒµ¹‚ Visual Basic-2012-13-½µ

  • 7/23/2019 Visual Basic-2012-13-

    1/26

  • 7/23/2019 Visual Basic-2012-13-

    2/26

    4, 811 00 22510-46222 www.platonos.gr2 / 26

    1. 41.1 41.2 Visual Basic 5.0 81.3 91.4 ANTIKEIMENO Label 91.5 Text (Text Box) 101.6 OptionButton & Frame 101.7 CheckBox 111.8 CommandButton 111.9 ListBox 121.10 ComboBox 121.11 Timer 131.12 Image 131.13 Picture 131.14 (Control Arrays) 142. (EVENTS) 142.1 DragDrop 142.2 MouseDown 142.3 keyPress ASCII 153. 163.1 163.2 Fontsize 163.3 163.4 rnd 163.5 randomize timer 163.6 if 163.7 case 17

  • 7/23/2019 Visual Basic-2012-13-

    3/26

    4, 811 00 22510-46222 www.platonos.gr3 / 26

    3.8 (Loop) For .... Next 183.9 While Wend 193.10 Do .Loop until 193.11 Do .Loop while 203.12 msgbox() 203.13 InputBox 213.14 LEN() 223.15 Mid() 223.16 val() 223.17 instr() 223.18 IsNumeric() 233.19 Visual Basic 233.19.1 ScaleWidth ScaleHeight 233.19.2 233.19.3 Line 233.19.4 ForeColor 24

    3.19.5 Circle 243.19.6 Line Circle 243.19.7 DrawWidth 253.19.8. 253.20 253.21 ASCII 25

  • 7/23/2019 Visual Basic-2012-13-

    4/26

    4, 811 00 22510-46222 www.platonos.gr4 / 26

    1.

    1.1 ,

    . compiler (

    ) ,

    ,

    . , ,

    . ,

    .

    (compiler) .

    , ,

    / 1000 .

    Pascal

    Basic

    C++

    Program demo1;Var I:integer;

    BEGINFor I:=1 to 100 do

    BeginWriteln( );

    End;END.

    For I=1 to 1000Print

    Next I

    #include using namespace std;

    int main(){int i;

    for(i=1;i

  • 7/23/2019 Visual Basic-2012-13-

    5/26

    4, 811 00 22510-46222 www.platonos.gr5 / 26

    /,

    RAM.

    () , , . ,

    , .

    4 . :

    ) A (integer) : ( )

    ( ), 19.

    ) (real) : (

    ), 19,3.

    ) (string) : ,

    ) (Boolean): .

    true false.

    .

    .

    _. .

    (

    ).

    :

    : George, Maria, 300, _300, _123, k2

    : George 1 ( ), for( ,

    )

    =

    = .

    Integer.

    :

    =15

    =18

    =23+3

    . .

    . 15, 18

    26. ,, 26.

  • 7/23/2019 Visual Basic-2012-13-

    6/26

    4, 811 00 22510-46222 www.platonos.gr6 / 26

    (

    ( ) =

    . =+1.

    1 ( )

    ( Integer )

    =3

    = 4

    = +

    7.

    :

    = 10

    = +

    () +

    .

    :

    = =38.9 =true

    Visual Basic, ,

    . .

    =12, integer

    =Maria 12, string

    =12.4 real

    =false, boolean

    .

    :

    +-*/^ ( )

    A=10B=20C=A+B

    C 30

    \ ( )

    mod( )

    A=19B=6C=A\BD=A mod B

    C 3 D 1

    = () ()>= ( )

  • 7/23/2019 Visual Basic-2012-13-

    7/26

    4, 811 00 22510-46222 www.platonos.gr7 / 26

    AndOrNot

    A=10B=20C=15A>20 and B>10

    A>20 or B>10

    Not (A>20)

    H false( )

    H true( )

    ( >20 )

  • 7/23/2019 Visual Basic-2012-13-

    8/26

    4, 811 00 22510-46222 www.platonos.gr8 / 26

    1.2 Visual Basic 5.0H Visual Basic 5.0

    ,

    Windows.

    ,

    ( .

    object oriented programming.

    Visual basic

    Visual Basic 12.

    Visual Basic 5, () sites .

    , Form1

    . (

    ) :

    .

    .

    Label

    label.

    /.

    .

    .

    ()

    (properties) .

    . .

    .

    :

    view Properties Window ToolBox.

  • 7/23/2019 Visual Basic-2012-13-

    9/26

    4, 811 00 22510-46222 www.platonos.gr9 / 26

    1.3

    .

    :

    BorderStyle Caption ( ) .

    ext, Caption TextBackColor ForeColor CaptionFont captionAlignment CaptionDragmode 1 DragIcon Visible true , ToolTipText '

    .Top

    ( )

    Left (

    )Height Width Enabled

    Tag .

    .

    (Properties Window) . :

    . =

    Caption Label1 :

    Label1.Caption=

    1.4 ANTIKEIMENO Label

    ( ,

    ) . .

  • 7/23/2019 Visual Basic-2012-13-

    10/26

    4, 811 00 22510-46222 www.platonos.gr10 / 26

    1.5 Text (Text Box)

    .

    . .

    Text : text . . .

    . text text1. , ( ) text1.text.

    text1.text=.. Text1.Text="...........",

    .txt

    open "" for input as #1text1.text = input$(LOF(1),1)close #1

    TextBox!!!

    1.6 OptionButton & Frame

    ( multiple choice). Option1, Option2, Option3, Option1(0), Option1(1), Option1(2),. ( control array, )

    OptionButton

    OptionButton OptionButton. 4 OptionButton . OptionButton.

    optionButton

  • 7/23/2019 Visual Basic-2012-13-

    11/26

    4, 811 00 22510-46222 www.platonos.gr11 / 26

    frames .

    Value true (1) false (0).Style Standard ( -

    ) Graphical ( , )

    Picture Style Graphical

    1.7 CheckBox

    Check1, Check1, Check1, Check1(0),Check1(1), Check1(2),.

    CheckBox

    Value true (1) false (0).

    : 1 true option buttons

    Style Standard ( - ) Graphical ( , )

    Picture Style Graphical

    1.8 CommandButton

    . O . , ,

    CommandButton, .

    Style Graphical picture

  • 7/23/2019 Visual Basic-2012-13-

    12/26

    4, 811 00 22510-46222 www.platonos.gr12 / 26

    Picture .

    1.9 ListBox

    ( ) .

    .

    .addItem

    list1

    dogcatbox

    List1.additem "dog"List1.additem "cat"List1.additem "box"

    , .

    . ,

    .

    Y listindex .

    "cat" listindex 1 (

    0). listcount. List List1, list1.listcount,

    1.10 ComboBox

    ListBox .

    .addItem

    Combo1

    ComboBox dogcat

    box

  • 7/23/2019 Visual Basic-2012-13-

    13/26

    4, 811 00 22510-46222 www.platonos.gr13 / 26

    Combo1.additem "dog"Combo1.additem "cat"Combo1.additem "box"

    listindex listcount list boxes

    1.11 Timer

    .

    Timer . Timer ( interval, ! 1000 Interval 1

    .

    Timer

    enabled interval (

    0, 200)

    1.12 Image

    Picture ImageStretch true (

    ) Image

    1.13 Picture

    Picture PictureAutosize true (

    )

  • 7/23/2019 Visual Basic-2012-13-

    14/26

    4, 811 00 22510-46222 www.platonos.gr14 / 26

    1.14 (Control Arrays)

    .

    26 command buttons caption ( Z). 26 command buttons, command1, command2, .Command26, command buttons. command button command1. , control array . commandbuttons . command1(0), command1(1), ., 26 command1(25). (index). caption A,B,Z buttons

    for ( : 3.8).For i=0 to 25

    Command1(i).Caption=chr(i+65)Next i

    command buttons . index. command button control array

    Private Sub Command1_Click(Index As Integer)Msgbox( command1(index).caption )

    End Sub

    command1 button.

    2. (Events)

    . ,

    .

    ( ).

    2.1 DragDrop

    . , source.

    2.2 MouseDown

    ' ( ).

    To chr() Ascii. chr(65) .

    ASCII , . (2.3)

  • 7/23/2019 Visual Basic-2012-13-

    15/26

    4, 811 00 22510-46222 www.platonos.gr15 / 26

    2.3 keyPress ASCII

    textboxes. scii () KeyAscii. KeyAscii

    . text1, .

    PrivateSub Text1_KeyPress(KeyAscii As Integer)If KeyAscii < 48 Or KeyAscii > 57 Then

    KeyAscii = 8EndIf

    EndSub

    ( Ascii 0 48, 1 49 Ascii 9 57. Ascii 8 Backspace). , text1 (.. !) backspace . ,

    !!! : ,

    Msgbox() :

    PrivateSub Text1_KeyPress(KeyAscii As Integer)MsgBox(KeyAscii)

    EndSub

    ASCII

    ASCII

    0..9 48..57

    backspace 8

    space 32

    Esc 27Enter 13

    A..Z 65.. 90

    a..z 97..122

    ..() 193..209..() 211..217. 210

    .. ( ) 225..249

  • 7/23/2019 Visual Basic-2012-13-

    16/26

    4, 811 00 22510-46222 www.platonos.gr16 / 26

    3.

    3.1 ()

    , , .

    .

    3.2 Fontsize

    .Fontsize=15 .Fontsize-13 .Fontsize=21

    3.3 .FontBold [= true false] .FontItalic [= true false] .FontStrikethru [= true false] .FontUnderline [= true false]

    3.4 rnd rnd*10 0 9.

    rnd*64 0 63,999

    rnd*128 0 127,999rnd*50 0 49,999rnd*10 0 9,999 int(rnd*50) 0 49, int integer=, . 1+int(rnd*50) 1 50 1+int(rnd*10)