???????????????? ???????? Email : Charoensuk_eau@yahoo.com - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

???????????????? ???????? Email : Charoensuk_eau@yahoo.com

Description:

Email : Charoensuk_eau_at_yahoo.com Writing Windows Applications with Visual Basic The Windows ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 29
Provided by: 12829
Category:

less

Transcript and Presenter's Notes

Title: ???????????????? ???????? Email : Charoensuk_eau@yahoo.com


1
???????????????? ????????Email
Charoensuk_eau_at_yahoo.com
2
Writing Windows Applications with Visual Basic
  • The Windows GUI

3
Graphic User Interface
  • Graphic User Interface (GUI) comprises
  • Forms
  • Controls
  • Event-driven programming

4
Planning Visual Basic Projects
  • The three-step process for planning projects
  • Design the user interface
  • Sketch the screens with forms and controls needed
  • Establish the objects' properties
  • Write down the properties for each object
  • Plan the Basic code
  • Write out pseudocode for actions your program
    will perform

5
Writing Visual Basic Projects
  • The three-step process for writing projects
  • Design the user interface
  • Create the forms and controls you previously
    sketched
  • Set the objects' properties
  • Give each object a name and set their properties
  • Write the Basic code
  • Write out Visual Basic code to carry out your
    application's actions

6
Visual Basic Projects
  • Visual Basic projects create several files
  • Project file .VBP
  • Holds the names of other files in the project
  • Form files .FRM
  • Each form is saved as a separate file
  • Form file contains a description of a form's
    objects and the Basic code attached to a form
  • Standard code module .BAS (optional)
  • Custom controls .OCX (optional)
  • Resource File .res
  • Class Module .cls

7
The Visual Basic Environment
  • Form, Project Explorer, Properties, and Form
    Layout Windows
  • Toolbox
  • Main Visual Basic window
  • Toolbar, Form location size information
  • Help
  • Design- , Run- , and Break Time

8
Set Up Your VB Workspace
  • Set up Options to reflect these settings

9
Write Code
  • You write code enclosed in event procedures,
    which respond to typical VB events.
  • Private Sub cmdPush_Click()
  • . . . (your code goes here)
  • End Sub
  • VB automatically supplies the event procedure
    Sub/End Sub statements
  • Remark statement is any code line beginning with
    an apostrophe
  • Assignment statement
  • End statement

10
Write Code
Object
Event
Code
11
????????
12
Toolbox
Pointer
PictureBox
Label
TextBox
Frame
CommandButton
OptionButton
Check Box
ComboBox
ListBox
VScrollBar
HScrollBar
Timer
DriveListBox
FileListBox
DirListBox
Shape
Line
Data
Image
OLE
13
????? Prefix ?????????????? Object ?? Control
Control Prefix
Combo Box cbo
Check Box chk
CommandButton cmd
Directory ListBox dir
Drive ListBox drv
File ListBox fil
Frame fra
Form frm
Ole Client Ole
Option button Opt
Vertical Scrollbar vsb
Control Prefix
Grid grd
Horizontal Scrollbar hsb
Image img
Lable lbl
Line lin
List Box lst
Menu mnu
Picture box Pic
Shape Shp
Timer tmr
Text Box txt
14
Basic Control
  • Label ??????????????????????????????????????????
    ???? ?????????????????????????
  • Name ??????????????
  • AutoSize ??????????????????????????????????????
  • Caption ??????????????????????????????
  • Font ????????? ???? ?????????????????????????
  • ForeColor ???????????????????????????
  • BackColor ???????????????????????

15
Basic Control
  • Text Box ????Control ???????????????????????????
    ?? ?????????????????????????
  • Name ??????????????
  • Enabled ??????????????????????????????
  • Max Length ??????????????????????????????????????
  • Visible ??????????????????????????????????????
  • Text ???????????????????????????????????????
  • MultiLine ?????????????????????????????????????

16
Basic Control
  • Command Button ??????????????
    ?????????????????????????
  • Name ??????????????
  • Caption ?????????????????
  • Enabled ??????????????????????????????
  • Picture ??????????????????????????????????
  • Style ???????????????????????????????
  • ToolTipText ??????????????????????????????????

17
Basic Control
  • Option Button ??????????????????????????????????
    ????????????
  • ?????????????????????????
  • Name ??????????????
  • Caption ?????????????????????????????
  • Value ????????????????????????????????

18
Basic Control
  • CheckBox ?????????????????????????????? 1
    ????????
  • ?????????????????????????
  • Name ??????????????
  • Caption ?????????????????????????????
  • Value ????????????????????????????????????????
  • 0 Unchecked ????????????
  • 1 Checked ?????????
  • 2 Grayed ?????????????????????

19
Basic Control
  • Image ???????????????????? ????????????????????
    ?????
  • Name ??????????????
  • Picture ???????????????
  • Stretch ????????????????????
  • PictureBox ????????????????????
  • ?????????????????????????
  • Name ??????????????
  • Picture ???????????????
  • AutoSize ????????????????????????????? True

20
Basic Control
  • Command Button ??????????????
    ??????????????????????????????????????????
    Property Name
  • ????
  • Private Sub cmdShow_Click()
  • cmdShow.Caption ????????????????
    ????????
  • End Sub
  • ???????? ???????????????????????????
    Form,TextBox, Label ????????????????????????????

21
Basic Control
  • ListBox ????????????????????????????????
    OptionButton ?????????????????????????????????????
    ???????????
  • ?????????????????????????
  • Name ??????????????
  • List ???????????????????? ListBox

22
Basic Control
  • ComboBox ???????????????????????????????????
    TextBox ??? ListBox
  • ?????????????????????????
  • Name ??????????????
  • Style ?????????????????????????????????
  • 0DropDown Combo ????????????????? TextBox ???
    ListBox
  • 1Simple Combo ????????????? TextBox ??????????
  • 2DropDown List ????????????? ListBox ??????????
  • List ???????????????????? ComboBox

23
Basic Control
  • HScrollBar ??? VScrollBar ???
  • HScrollBar ?????????????????
  • ???? VScrollBar ??????????????????
  • ?????????????????????????
  • Min ???????????????????
  • Max ??????????????????
  • Value ???????????? ScrollBar

24
Basic Control
  • Line ???? Control ?????????????
  • ?????????????????????????
  • Name ??????????????
  • BorderStyle ??????????????????
  • BorderWidth ??????????????
  • Timer ???? Control ????????????????????????????
    Run ??????????????????????????????????????????????
    ???????????????????????????

25
Basic Control
  • Shape ??????????????????????? ???????? Property
    Shape ?? 6 ?????????
  • 0 Rectangle ??? ???????????????????
  • 1Square ??? ????????????????????
  • 2Oval ??? ???????
  • 3Circle ??? ????????
  • 4Rounded Rectangle ??? ??????????????????????????
    ???
  • 5Rounded Square ??? ?????????????????????????????
    ?

26
Basic Control
  • DriveListBox ??????????????? Drop-Down ListBox
    ??????? Drive ?????
  • DriveListBox ??????????????? Drop-Down ListBox
    ??????? Drive ?????
  • FileListBox ??????????? File ?? Directory
    ????????????? DirlistBox

27
Basic Control
  • OLE (Object Linking and Embedding)
    ?????????????????????????????????????????????
    Window
  • ??????????? Control OLE ???? Form
  • ????? OptionButton Create from File
  • ???????? Browse ????????? Calc ?? Directory
    Windows
  • ??????? Check Box Display As Icon

28
????????????
  • Menu Editor ??????????????????????
  • Caption ???????????????????????????????????
    ???? ??????? File,Edit,View ???????
    ???????????????????????????????? ??????
  • Name ????????????????????????????????????? VB
    ?????????????????? 1 Object
  • Shortcut ?????????????? Drop-Down List
    ???????????? Hot Key ?????????????? Alt-X
Write a Comment
User Comments (0)
About PowerShow.com