OPI_LR2011_ch2m1
.pdf,
“ ”
6.050103 “' (” ( + )
I. C#
1
2011
2
-
“/ (”
6.050103 “' (” ( + ). 0 11. 2#.
4 1 / 6. /. /, 7. . 8, /. /. /, /. 1. 9. – ((: <=, 2011. – 70 .
6: 6 / /, . . .,
7 8,
/ / /, . . ., . . / 1 9,
?: 2./. 2, . . .,
@
: 6.@. ', . . .,
(
+
' 4 1
“30” 2010 .
3
........................................................................................................... |
5 |
|
1 1 ! " # Visual Studio C#............... |
6 |
|
1.1 |
.......................................................................................... |
6 |
1.2 |
/ .............................................................. |
6 |
1.2.1 9 – Button ................................................................................. |
8 |
|
1.2.2 0 – CheckBox ........................................................................ |
8 |
|
1.2.3 ? – RadioButton ............................................................... |
9 |
|
1.2.4 S – GroupBox............................................................ |
9 |
|
1.2.5 ' – Textbox................................................................. |
15 |
|
1.2.6 ? Y – R ht t ............................................. |
15 |
|
1.2.7 2 – ListBox.............................................................................. |
15 |
|
1.2.8 2, \ ], – CheckedListBox ................................ |
15 |
|
1.2.9 @ ^ – 2b B ................................................... |
16 |
|
1.3 |
............................................................................. |
22 |
1.4 |
............................................................................................ |
24 |
1.5 |
9 ........................................................................ |
24 |
2 2 1 23 4 565!5 7 6 87 |
|
|
1 !7................................................................................................... |
25 |
|
2.1 |
........................................................................................ |
25 |
2.2 |
/ ............................................................ |
25 |
2.2.1 – Label.................................................................................... |
25 |
|
2.2.2 – LinkLabel ............................................................................ |
26 |
|
2.2.3 S – TrackBar........................................................................... |
26 |
|
2.2.4 1 – ProgressBar .................................................. |
26 |
|
2.2.5 ? – NumericUpDown .......................... |
26 |
|
2.2.6 2 – ListView............................................................................ |
30 |
|
2.2.7 h – TreeView ........................................................................... |
31 |
|
2.3 |
............................................................................. |
35 |
2.4 |
............................................................................................ |
37 |
2.5 |
9 ........................................................................ |
37 |
3 3 9 # 238 !7................................... |
38 |
|
3.1 |
........................................................................................ |
38 |
3.2 |
/ ............................................................ |
38 |
3.2.1 / System.String ..................................................... |
38 |
4 |
|
3.2.2 2 ............................................................................. |
39 |
3.2.3 System.Object.ToString().................................................................. |
40 |
3.2.4 ^ ................................................................. |
40 |
3.2.5 ' Y ............................................................................. |
46 |
3.2.6 ? ................................................................................ |
47 |
3.2.7 9 StringBuilder ............................................................................ |
49 |
3.2.8 ? .............................................................................. |
51 |
3.2.8.1 ................................................ |
51 |
3.2.8.2 / . 9
(Character classes)...................................................................................... |
52 |
3.2.8.3 9 + (Quantifiers)....................................................... |
54 |
3.2.8.4 ........................................................ |
54 |
3.2.8.5 o ............................................................................... |
54 |
3.2.8.6 @ . '
........................................................................................................ |
55 |
|
3.2.9 @ : Regex..................................... |
56 |
|
3.2.10 @ Match ...................................................... |
58 |
|
3.3 |
............................................................................. |
59 |
3.4 |
............................................................................................ |
60 |
3.5 |
9 ........................................................................ |
60 |
4 4 9 # < 6 !7 .................................. |
62 |
|
4.1 |
........................................................................................ |
62 |
4.2 |
/ ............................................................ |
62 |
4.2.1 ' ............................................................................... |
62 |
|
4.2.2 6 +............................................................. |
63 |
|
4.2.3 h ( +....................................... |
63 |
|
4.3 |
............................................................................. |
66 |
4.4 |
............................................................................................ |
67 |
4.5 |
9 ........................................................................ |
67 |
4 5............................................................................................ |
7069 |
5
@A
h ]
+ Visual Studio C#.
@ +
^
^. , (
, -
. = , ,
. = -
, -
. ' - ( Y .
h ( ( ]
+ , ( ] ’^
.
] :
–Y ( ^ ,
, +, , i ,
, \ ] , );
–;
–;
–;
–;
–.
^ + A4 (210 × 297 ). = \ ^ ] . '
– 20 . 6 Y ^^ ^ -
\ ^ +.
' -
, ,
( , -
+ ]^
. 2
. h
,
.
6
1 B 9 9 9 B 1
C VISUAL STUDIO C#
1.1 5 7
@ ( -
\ ' Microsoft Visual Studio C#.
1.2 " 4 5 5 7K 4 "43 ! 4
' 2# +. 9 (-
+ ( . 9 ( -
( , ,
, +, – + -. ' 2# \ Visual Studio - ] 10 ( , Windows Application, Class Library, Web Control Library, ASP.NET, Application ASP.NET Web Service. <
^] .
Visual Studio.NET — \ -
^ 2#. Visual Studio.NET ] ^
VB, 2#, C++, + Setup (^ ) Y
Y. h \ , ^- ] Visual Studio .NET, ^
File/New/Project... ' ' , -
( . 1.1.
= ( (
)
( ^ ( ^-
. @ Visual C# Project.
^
. { ( Windows-' (Windows Application),
1 (ASP.NET), (Console Application) Y. @ Windows Application.
7
? 1.1 – @
9 , ( ^
Y , Y. < /9. = \ -
. @ ( . 1.2. ] -
+ . '
\ ] Solution Explorer Y -, Class View Properties Explorer. \ ] Toolbox, -
2#. , ( ^
View.
? .
8
? 1.2 – o \ Visual Studio .NET
1.2.1 87 – Button
– 9 ^ ] ,
] ( ] ]^ ]^ –
. , \ ^, –
+
^.
/ ^ ] Click.
1.2.2 58 8 7 – CheckBox
– ' Y, \ -
, \ ] , ] -
- ^. ^ -
^ , ,
\ Y . | Checkbox - ( 3 – , Y. < Y
9
] , (
.
1.2.3 9 34 8 87 – RadioButton
– - ( }. ~ ] , \ -
] - ^ ,
( ^ ( . 1 ]
^ Y. <, ( Y
. 9 , ( Y
( ( ] ^ ^ ).
1.2.4 B6 8 1 " 2 – GroupBox
– S ] -
'] . <, '] ( . . 1.3)
? 1.3 – ' ']-
? ^
+: ^ , -
^ . 0 –
.
2 Windows Forms ^ TestButtons.
( .
10
+: Name = «TestButtonsForm» Text=«
».
= + Groupbox,
RadioButton, CheckBox Button ( . 1.4). \ GroupBox. 1 Y ' ( ^.
? 1.4 – ' + TestButtons
= :
button1: |
Text – |
groupBox1: |
Text – |
radioButton1: |
Text – Y |
radioButton2: |
Text – |
radioButton3: |
Text – ] |
checkBox1: |
Text – |
|
Checked – True |
(, \ Y + Y ,
.
= Y , -
\ Visual Studio .NET:
using System;
using System.Drawing; using System.Collections;
using System.ComponentModel;