Title: Printing Reports ????????????
1Printing Reports ????????????
2?????????????????????????????? (Printable Objects)
- ??????????? ((Picture Box)
- ?????????????????? ((Immediate Window)
3???????????
Form1.Print ??????? Form1
Printer.Print ??????? ????????????
Picture1.Print ??????? ???????????
Picture1
Debug.Print ??????? Immediate Window
4?????????????????
Object.Print varList or contList
Object ??????? ????????????????????????????
?????? Form, PictuerBox, Printer, Debug
(??? Immediate Window)
varList ???????????????? ??????????????????
???? ????????????????? ???????????? 1 ???
???? ??????????????????? ????? ( , )
???????? ????? ( )
5contList ??????????????? ??????????????????
???? ????????????????? ???????????? 1 ???
???? ??????????????????? ????? ( , )
???????? ????? ( )
6??????????????????????????????????
??????????????????????????????
???????????????????????????????
???????????????????????? ?????????????
??????????????????????????? ?????????????????????
??? ????????????????????????????????????? (Print
Zone) ?????? 1 ??????????? 14 ????????
7???????? ???????????????????????????
Private Sub Form_Click() Form1.Print I am
studying VB End Sub
??????????????????????? Form1 ????????? Run
??????????? ??????????????????????????????????
??????? I am studying VB ????????????????
8???????? ??????????????????????????
Private Sub Form_Click() Dim j as Integer
Dim x as Single Dim t as String j 1500
x 12.25 t Thai Form1.Print jxt End
Sub
9???????? ??????????????????????
Private Sub Form_Click() Dim j as Integer
Dim x as Single Dim t as String j 1500
x 12.25 t Thai Form1.Print j,x,t End Sub
10????????????????????
????????????? ???????? Spc(n)
?????????? n ????????
????????? Tab(n)
???????????????????? n String(n,c)
??????????? c ??????????? n ?????
11???????? ?????????????? Spc ??? Tab
Private Sub Form_Click() Dim j as Integer
Dim x as Single Dim t as String j 1500
x 12.25 t Thai Form1.Print "Space
using Spc Form1.Print Spc(10) j Spc(10)
x Form1.Print "Space using Tab" Form1.Print
Tab(10) j Tab(20) x End Sub
12???????? ?????????????? String
??????????????????????????? ????? 10 ?????? ?
?? 80 ???
Private Sub Form_Click() Dim I as Integer for I
1 to 10 Form1.Print String(80,.) Next End
Sub
13?????????????????????????????
??????????
???????? Currency ?????????????????????????????
??????????? Fixed ?????????? ????????? 1
??????????? ??? 2 ???? ??????????????
14?????????????????????????????
??????????
???????? Standard ????????????????????????????????
???????? ????????????? ????????? 1 ????
????????????? ??? 2 ???? ???????????????? Perc
ent ????????????????????? () Scientific ?????????
????????????? E ??? ???????? E
15?????????????????????????????
??????????
???????? Yes/No ???? Yes ???????????? 0
??? No ??? ??????? 0 True/False
???? True ???????????? 0 ??? False
?????? ???? 0 On/Off ???? On
???????????? 0 ??? Off ??? ??????? 0
16????????????????
Private Sub Form_Click() Dim j as Long Dim x,y
as Double j 1285547204 x 0.000000456 y
7562.2147 Form1.Print j Form1.Print x
Form1.Print y End Sub
17????????????????????? Currency
Private Sub Form_Click() Dim j as Long Dim x,y
as Double j 1285547204 x 0.000000456 y
7562.2157 Form1.Print Format(j, "Currency")
Form1.Print Format(x, "Currency") Form1.Print
Format(y, "Currency") End Sub
18????????????????????? Fixed
Private Sub Form_Click() Dim j as Long Dim x,y
as Double j 1285547204 x 0.000000456 y
7562.2157 Form1.Print Format(j, "Fixed")
Form1.Print Format(x, "Fixed") Form1.Print
Format(y, "Fixed") End Sub
19????????????????????? Standard
Private Sub Form_Click() Dim j as Long Dim x,y
as Double j 1285547204 x 0.000000456 y
7562.2157 Form1.Print Format(j, "Standard")
Form1.Print Format(x, "Standard") Form1.Print
Format(y, "Standard") End Sub
20????????????????????? Percent
Private Sub Form_Click() Dim j as Long Dim x,y
as Double x 0.0245759 Form1.Print Format(x,
Percent") End Sub
21????????????????????? Scientific
Private Sub Form_Click() Dim j as Long Dim x,y
as Double j 1285547204 x 0.000000456 y
7562.2157 Form1.Print Format(j, "Scientific")
Form1.Print Format(x, " Scientific ")
Form1.Print Format(y, " Scientific ") End Sub
22????????????????????? Yes/No, True/False ???
On/Off
Private Sub Form_Click() Dim j,k,i as Integer j
0 k 2 l 1 Form1.Print Format(j,
Yes/No") Form1.Print Format(k, " True/False ")
Form1.Print Format(l, " On/Off ") End Sub
23????????????????????????????????????
?????????
???????? 0 ???????????? ???????? ??????
0 ???????????? ???????? ??????? .
?????????????????????????????? ,
????????????????????????????????????
???????????????????????
24?????????
???????? E-,E,e-,e ??? E-, e-
??????????????????????????
???????????????????????? ???????????? ???
??? ??????????????????? ?????? E, e
???????????????????????????????????
?????
25???????????????????????
??????????
???????? Long Date ??????????? ????? ??
Medium Date ??????????? ????????
????????????? ???????????????? Short
Date ???????? ????? ?????????????????
??????????????? ????????????????
???????
26??????????
???????? Long Time ????????????????? Medium
Time ???????????AM ???? PM Short Time
???????????
27?????????????????????????????
Private Sub Form_Click() Dim dateX As Date
dateX Now Form1.Print " General date ",
dateX Form1.Print "Long Date ", Format(dateX,
"Long Date") Form1.Print "Medium Date ",
Format(dateX, _ "Medium Date")
Form1.Print "Short Date ", Format(dateX, "Short
Date") Form1.Print " Long Time ", Format(dateX,
"Long Time") Form1.Print " Medium Time ",
Format(dateX, "Medium Time") Form1.Print "
Short Time", Format(dateX, "Short Time") End Sub
28Working with Fonts ???????????????????
29?????????????????????? ???? ?????????????????????
????????? ????????
Name ????????????????????????
??? ???? ??? ??????????????????????????????????
?? Form1 ?????????????????
Form1.Font.Name AngsanaUPC
30????????? ????????
Size ????????????????????
?????????????? ???? Form1.Font.Size
14 Picture1.Font.Size 72 Bold
???????????????? ???????????????
?????? ????
Form1.Font.Bold True
??????????????????????????????????
31?????????
???????? Form1.Font.Bold
False ?????????????????????????????????
????? ??? ????????????
Italic ??????????????????????
?????????? ???????????? Form1.Font.Italice
True ?????????????????????
???????????????
32?????????
???????? Underline ??????????????
1 ???? ??????????
????????????? ???? Picture1.Font.Underline
True ???????????????????????
???????????????? ??????? ????
Picture1.Font.Underline
False ???????????????????????
???????????????? ??????????????????????
33?????????
???????? StrikeThrough ??????????????????
1 ???? ?????????? ?????????????
???? Picture.Font.StrikeThrough True
????????????????????????????????????
??? ??????? ????
Picure1.Font.StrikeThrough False
??????????????????????? ????????????????
??????????????????????
34?????????
???????? Weight ????????????????????????????????
????? ??????????????
???? Form1.Font.Weight 400
?????????????????
Form1.Font.Weight 700
??????????????????
35???????????????????
??????????????????????
????????
?? vbBlack ?? (Black) vbRed
??? (Red) vbGreen ????? (Green) vbYellow ???
??? (Yellow) vbBlue ??????? (Blue) vbMagenta ?
??? (Magenta) vbCyan ??? (Cyan) vbWhite ???
( White )
White
36??????????????????????? (RGB)
??????
RGB(red, green, blue)
red ??????????? ???????????????? 0 - 255 green
????????????? ???????????????? 0 - 255 blue
??????????????? ???????????????? 0 - 255
37??????????????????????? RGB
38????????????? (QBColor)
??????
QBColor(color)
color ?????????????????????? ????????????????
????? 0 - 15
39 ???????? ?? ???????? ?? 0 Black 8 Gray 1 Blu
e 9 Light Blue 2 Green 10 Light
Green 3 Cyan 11 Light Cyan 4 Red 12 Light
Red 5 Magenta 13 Light Magenta 6 Yellow 14 Lig
ht Yellow 7 White 15 Bright White
40?????????????????????????????????????? ?
??????????? ForeColor ???????????? ?
????????????? ???? Form1.ForeColor vbRed
???? Form1.ForColor RGB(255,0,0)
???? Form1.ForColor QBColor(4) Form1.Print
?????????????? ??????? ??????????????
?????????? Form1 ?????????
41???????? ????????????????????????
???????????????????????????
??????????
????????????? ???????????
???????????? ????????????? Form1 Pict
ure1 Picture1 Command1 cmdPrintForm
??????????????? Command3
cmdPrintPicture
?????????????????? Command3 cmdExit
????
42(No Transcript)
43?????????????????????????
44???? Run ??????? ???????? ??????????????? ???
??????????????????
45Displaying Graphic ???????????????
46????????????????????
????????? ?????????????????? ?
?????????????????? ?????????????????????
???????????????? ????????????????????????????????
????????????????? ???????????????????????????????
????????? ?????????????????????? X ??? ??? Y
47??? X ??? Y ????????
??? X
??????????
??? Y
48???????? (ScaleMode)
???? (Twip) 1 ???? 1440 ???? ???? 567
????????? ??? (Point) 1 ??? 72
???? ?????? (Picxel) ???????????????????? ??????
(Character) ?????????? 1 ??? ?????????????
120 ???? ????????? 240 ????).
49???????????????????
??????
object.ScaleMode value
??? ???????? 1 VbTwips (????????????)
2 VbPoints 3 VbPixels 4 vbCharacters 5
VbInches 6 VbMillimeters 7 VbCentimeters
50Drawing Methods ?????????????
51????????????????????????? ?????? ???????
?????????????? ??????? ????????? ??????
Bitmap, JPEG ??? GIF
52??????????????????????????????
Height ScaleHeight Width
ScaleWidth Top ScaleTop Left ScaleLeft
53Height, Width ???????????????????????.??????????
???????? ???? Height ??? Width ???????????
?????????????????????????????????????????????
??????? ???????????????????? ?
?????????? ScaleHeight,ScaleWidth
??????????????????????? ?????????????????????????
??? ???????? ???? ScaleHeight ??? ScaleWidth
??????????????????????????????????????????????????
?????????? ? ???????
54Top ?????????????????????????????????????????? Le
ft ????????????????????????? ????????????????????
? ScaleTop ??????????????????????????????
??????????????? 0 ???? ScaleLeft
???????????????????????????????? ???????????????
0 ????
55Top, Left
ScaleTop,ScaleLeft
FORM
Height
ScaleHeight
ScaleWidth
Width
56??????? ScaleHeight ??? ScaleWidth
??????? ScaleHeight ??? ScaleWidth
?????????????????????????????? ?????????????????
?????????????????????????? (ScaleMode) ????????
???????????????????? ????????????????????? X ???
Y ??????????????????? ????????????????????????????
????????????????????? ??????????????????????
57 ???????????? ScaleHeight 100 ScaleWidth
100 ??????????? ???????????????????????????????
100 ???????? ? ??? ????????????????????????????
????????? 100 ???????? ? ???
58???????? ???????????? 1
???????????????????? 2 ?????????????????????
? 3 ?????????????????????????? 100 ????
4 ?????????????????????????????
59???????????????????? 0.9 ???????????????
????????????????????????????
????? ????????? 14 ??? ??????? ????????????
?????????????? (.) ???????????????????????
60????????????
??????????????? X 20, Y 50
61???????
62??????????????????????????????????????????
???????????????
63???????
64?????????????????????????
- Cls ?????????????????????
- Line ???????????????? ????????????????
- Circle ????????? ????? ???? ????????
- Point ??????????????????????????????
- Pset ?????????????????????????????
- Print ?????????????????
65?????????????
????????????
object.Line (x1, y1) - Step (x2, y2), color,
BF
object ????????????????????????????? Line
???????????????? (x1, y1) ??????????????????
- ??? Step
????????????????? x,y ?????????????????? ????????
??????????????????????? ???????? Step ??????
x,y ???????????????????
66(x2, y2) ???????? Step ????????????????????????
????? Step ?????????????????????????? color
???????????????? ??????????????????????????
???????? RGB ???????????? QBColor ?????
B ????????????????
????????????????????????????
????????????????????????????????????? F
????????????????????????????????? ??????? ???
???????????? ???????????????????????????
??????? FillColor ??? FillStyle ????????
67???????? ???????????????????????????????????
??????????
????????????? ???????????
???????????? ????????????? Command1
cmdLine
??????? Command2 cmdExit
????
68(No Transcript)
69(No Transcript)
70???? Run ??????? ???????? ???????
71???????? ???????????????????????????????????
????????????????????????????????????
????????????? ???????????
???????????? ????????????? Command1
cmdLine
????? Command2 cmdExit
????
72?????????????????
73??????????????????????????
74???? ??????????????? ??????????
75???????? ?????????????
??????????
????????????? ???????????
???????????? ????????????? Command1
cmdLine
????? Command2 cmdExit
????
76?????????????????
77??????????????????????????
78???? Run ??????? ???????? ????????