Title: Building GUI with .NET Windows Forms
1(No Transcript)
2Windows Forms
???????????? ?? .NET Framework
http//www.nakov.com/dotnet/
?????????? ?? ???????? ????????????? ????????? ?
??????? ?????
?????????? ???????? ?? ?????????? ?? ???????
academy.devbg.org
3?????????? ??????
- ?????? ???????? ?? .NET Framework
- ?????? ???????? ?? ????? C
- ?????? ???????? ?? ?????????? ? ????????? ? .NET
Framework - ??????? ?????? ?? ?????? ? Visual Studio .NET ?
Windows Forms ????????? ??
4??????????
- ????? ? Windows Forms?
- ????????? ??????????. ??????????? ????? ?? .NET
- ????????? ????? ?? Windown Forms
- ??????? ???????. ???????? ?? ?????????
- ?????? Control. ????? ?????? ????????
- ????? ?? ???????????? ?? ??????????
- ?????, ???????? ? ??????? ?????? Form
- ??????? ???????? TextBox, Label, Button
- ????????? ?? ???????? ??? ???????
- ?????????? ?? ?????????
- Windows Forms ?????????? ?? VS.NET
5?????????? (2)
- ?????????? ????????? ?????
- ????????? ?? ????????? ?????
- ????? Windows Forms ????????. ??????. ????? ?
???????????. ?????? ????? - ?????? ?? ????? ?? ????
- MDI ??????????
- ????????? ?? ?????
- ????????? ?? ????? (Data Binding). ????????? ?
CurrencyManager - ?????????? DataGrid
- Master-Details ?????????
- ??????????? ?? ?????
6?????????? (3)
- ??????? System.Drawing ? GDI
- ???????? ?? ???????
- ????????????? ????????
- ??????? ?? ???????? ? Internet Explorer
- ????? ? Windows Forms
- ??????? (Drag and Drop)
- ??????????????? ???? ?? ????????????
7????? ? Windows Forms?
- Windows Forms
- ?????????? ?? ?????????? ?? ??????????-??????????
???????? ????????????? ????????? (GUI) - ???????? ??????????? ?? Rapid Application
Development (RAD) - ???????????-??????????? ???????????
- ??????????, ???????? ?? ???????
- ??????? ?? GUI ?????????? ?? Delphi ? Visual
Basic 6, ? ????? ?? MFC - ??????? ????? ????? ?? ????????
- Data-aware ??????????
8????? ? Windows Forms?
- Windows Forms
- ???????? ????????? ?? Unicode
- ????????? ??????????? ? ??????????? ?? ????? ?
???????? - ???????? ActiveX ????????
- ???????? ???????? ?? ???????
- ?????????? ????? ?? ?? ?????????? ? Internet
Explorer - ??????? ?? Java ????????
- ??? ????????????? ??????????? (?? ??????? ??
ActiveX ??????????) - ????? ????????? ?? ??????? (GDI)
9Windows Forms ??????
public class SampleForm System.Windows.Forms.For
m static void Main()
SampleForm sampleForm new SampleForm()
sampleForm.Text "Sample Form" Button
button new Button() button.Text
"Close" button.Click new
EventHandler(sampleForm.button_Click)
sampleForm.Controls.Add(button)
sampleForm.ShowDialog() private void
button_Click(object sender, EventArgs e)
Close()
10???????????? 1
- ?????? ????? Windows Forms ??????????
11???????? ?? Windows Forms
System.Windows.Forms
Design
ComponentModel
????????? ???????? ?? ?????? ? ????????, ???????,
???????? ?? ????????? ?? ?????, ?? ?????, ??????,
????? ? ???????????, ???????, ??????? ? ??.
System.Drawing
????????? ?????? ?? GDI ????????? ?? Windows
?????? ? ?????, ?????, ??????????? ??????,
???????????? ?? ????????, ?????, ????????,
???????? ?? ??????? ? ??.
Drawing2D
Printing
Imaging
Text
12????????? ??????????
- ??????????
- ????????? ??????? (???????), ????? ???????
?????????? ?????? - ?????????????? (reusable)
- ???? ???? ????????? ?????????, ????? ??????
??????? - ????????
- ??????
- ???????
- ????????? ?? ???? ???? ?? ????? ?????????? ???
????????
13??????????? ????? ?? .NET
- ????????????? ????? ????????
- ????????? ?? ???????????? ? ?????????? ??
????????? ?????????? - ?????? ????? ?? ????????????
- ????????????? ????? ?? .NET Framework
- ?????? ??????? ?? ????????? ? ?????????? ?? .NET
?????????? (????????? ?????) - ???????? ??????? ? ??????????, ????? ?????????
?????????? ?? ??????????
14??????????? ????? ?? .NET
- ????????????? ????? ?? .NET
- ????????? ?????????? ?? ??????????? ??
???????????? - ?? ????? ?? ?????? (design-time behavior)
- ?? ????? ?? ?????? (runtime behavior)
- ????????? ????? ???????????????? (reusability)
- ???????? ?????????? ? ??????????
- CLR ????????? ???????????? ???????????? ??
???????????? - ????????? ?????????????? ?? ???????????? ????? ??
?????? ? System.ComponentModel
15Windows Forms ? ????. ?????
- Windows Forms ? ??????? ?? ???????????? ????? ??
.NET - ????????????? ????? ???????? ?????????? ?
?????????? - Windows Forms ???????? ???????? ?
?????????-???????? - ?????????? ?? ?????? ?? ??????????? ??????????
- ?????????-???????? (?????, ???????, ??????, ...)
???????? ????? ???????? - ???????? (??????, ???????? ??????, ...)
???????? ?? ? ????????? ??????????
16????????? ????? ?? WinForms
- ??????????? ????? ?? Windows Forms ????????
- ????? (???????? ? ???????)
- ???????? (???????? ??????, ??????, ??????, ?????
? ???????????, ...) - ???????, ????? ?? ??????????
- ?????? ????? ?? ????????????
- ????? ?? ???????????? ?? ??????????
- ?????????? ?? ?????? ? ?????????
- ????????? ????? ?? ???????????? ? ??????? ??
????????? - ?????????? ????????? ????????? ?? ???????????????
???????? ? ???????? ?? ?????????? ?????
17????????? ????? ?? WinForms
- ???????? ????? ?? ????? Windows Forms ??????????
?????? ???? - ????????? ????? ?? ?????????
- ??? ?????????? ?? ????????? (????. ??????????? ??
???????, ????????? ?? ?????? ??? ??.) ??
????????? ???? - ?????? ??????????, ?? ????? ?? ?????? ???????????
- ??????? ? ???????????
- ??? ?????????? ? ?????????-????????, ?? ????? ?
???? ?? ?? ??? ?? ??????? ???????? ? ???????????
? ? ?? ??????? - ??? ????????? ?? ???????? ????? ?? ????????????,
?? ????? ???????????? ??
18??????? ???????
- ???????????? Windows Forms ????????
- ?????????? ?? ?????? ??????? ?? ?????????? ?
?????????-?????????? - ????????? ???????? ????????
- ??????? ?????? ???????
- Component .NET ?????????
- Control ???????? ???????? (?????????? ?
???????? ?????) - ScrollableControl ????????, ????? ????????
?????????? ?? ???????????? ?? - ContainerControl ????????, ????? ??????? ?????
???????? ? ????????? ??????????? ?? ??????
19???????? ?? ?????????
20?????? Control
- ?????? System.Windows.Forms.Control ? ?????? ??
?????? ???????? Windows Forms ???????? - ???????? ???????? ?? ??????? ?? ?????? Windows
Forms ???????? - ??-??????? ???????? ?? ????? Control
- Anchor, Dock ??????? ?? ????? ????? ??????????
?? "???????" ?? ?????????? ?? - Bounds ?????? ??????? ? ????????? ?? ??????????
? ?????? ????????? - BackColor ?????? ????? ?? ????
- ContextMenu ?????? ?????????? ???? (popup menu)
?? ??????????
21?????? Control
- ??-??????? ???????? ?? ????? Control
- Controls ??????? ???????? ?? ????????? ????????
(??? ???) - CanFocus ????? ???? ?????????? ???? ?? ????????
?????? - Enabled ????????? ??????????? ?? ?????????? (??
????? ??????, ?? ?????????) - Font ?????? ?????? (???, ????, ??????)
- ForeColor ?????? ????? ?? ??????????
- Location ??????? ????????? ?? ???????? ? ??????
????????? - Parent ?????? ?????????-??????????, ?????????
???????? ????????
22?????? Control
- ??-??????? ???????? ?? ????? Control
- Size ??????? ????????? ?? ??????????
- TabIndex ???????? ???? ??? ????????? ? ???????
TAB - TabStop ?????? ???? ?????????? ???? ?? ??
???????? ??? ????????? ? TAB - Text ?????? ?????, ??????? ? ??????????
- Visible ?????? ???????? ?? ??????????
- ??-????? ?????? ?? ????? Control
- Focus() ???????? ??????????
- Hide(), Show() ??????/??????? ??????????
23?????? Control
- ??-??????? ??????? ?? ????? Control
- Click ???????? ??? ???????? ? ??????? ?????
?????????? - Enter, Leave ????????? ??? ?????????? ?
???????????? ?? ?????????? - KeyDown, KeyUp ????????? ??? ????????? ?
????????? ?? ?????? (??? ??????????) - KeyPress ??? ????????? ?? ?????????????? ??????
- MouseDown, MouseUp, MouseHover, MouseEnter,
MouseLeave, MouseMove, MouseWheel ????????? ???
??????? ?? ???????, ????????? ????? ??????????
24?????? Control
- ??-??????? ??????? ?? ????? Control
- Move ???????? ??? ??????????? ?? ??????????
- Paint ???????? ??? ???????????? ?? ??????????
- Resize ???????? ??? ??????? ?? ??????? ??
?????????? - TextChanged ???????? ??? ??????? ?? ??????????
Text ?? ?????????? - Validating ???????? ?? ?? ????????? ?? ???????,
???????? ? ??????????
25???????????? ?? ??????????
- ? Windows Forms ?????????? ????? ?? ???????????
- ??? ??????????? ?? ????????
- ??? ????? ?? ???????? ????????
- ??? ??????? ?? ??????? ??? ????????? ?? ?????
???????? - ?????????????? ????? ?? ??? ?????
- Invalidate() ???????? ?? ???????????? ????????
???????? ??? ???? ??????? ? ??????? ?????????
"?????????" - Paint() ????????? ??????????? "?????????",
????????? ?? Invalidate() ? ???????? ????????
???????? ???????
26????? ?????? ????????
- ?????? ScrollableControl
- ?????? ?????????????? ?? ??????????
- AutoScroll ?????? ???? ??? ????? ?????????? ??
?????? ??????????? ?????????? ????? - HScroll, VScroll ??????? ???? ?????????? ?? ???
???????????? ? ?????????? ?????????? ????? - ?????? ContainerControl
- ????????? ?????????????? ?? ?????????? ?? ??????
- ActiveControl ??????? ??????????, ????? ? ??
?????
27?????, ???????? ? ???????
- ?????? System.Windows.Forms.Form
- ???????????? ????? (???????? ??? ????????? ?????)
? GUI ???????????? - ? ???? ????? ?? ?? ??????? ????????
- ??????? ???????? ?? ????? Form
- FormBorderStyle ?????? ???? ?? ??????? ??
??????? - Sizable ?????????? ?????????? ?????
- FixedDialog ?????? ? ????????? ???????
- None ??? ?????
- FixedToolWindow ????? ? ??????????? ? ????????
??????
28?????, ???????? ? ???????
- ??????? ???????? ?? ????? Form
- Controls ?????? ? ?????????? ??????????? ???
??????? - Text ???????? ?? ?????????
- Size ??????? ?? ?????????
- ClientSize ?????? ?? ???????????? ?? ???????
(??? ??????? ?) - AcceptButton ????? ?? ????????????
- ActiveControl ??????????, ????? ????? ??????
- ControlBox ?????? ???? ??????? ?? ??? ????????
?? ?????????, ??????????? ? ?. ?.
29?????, ???????? ? ???????
- ??????? ???????? ?? ????? Form
- Icon ?????? ????? ?? ?????????
- KeyPreview ??? ?? ?????? true, ?????????
??????? ?? ????????? ????????? ?? ????????????
????? ?? ?? ??????? ?? ???????????? ???????? - MinimumSize, MaximumSize ?????? ??????????? ??
??????? ?? ??????? - Modal ?????? ???? ??????? ? ???????
- Opacity ?????? ??????????? (0.00 1.00)
- MdiChildren, MdiParent ???????/??????
??????????? ?????/??????????? ?? ???????? ????? ?
MDI ?????
30?????, ???????? ? ???????
- ??????? ???????? ?? ????? Form
- TopMost ?????? ???? ??????? ???? ??? ??????
????? ???????? (always on top) - WindowState ??????? ??????????? ?? ???????
(????????, ???????????? ??? ?????????????) - ??????? ?????? ?? ????? Form
- Close() ??????? ??????? (?????? ? ? ???????????
???????????? ???????) - Show() ??????? ??????? ? ? ????????
- ShowDialog() ??????? ??????? ? ??????? ????? ?
????? ???? ???????? DialogResult ??????????
31?????, ???????? ? ???????
- ??????? ?????? ?? ????? Form
- LayoutMdi() ?????????? ????????? (MDI) ?????
(????????, ????????????, ??????????) - ??????? ??????? ?? ????? Form
- Activated / Deactivate ??????? ??? ?????????? /
???????????? ?? ??????? (?????????? / ?????? ??
??????) - Closing ??????? ?? ??? ????????? ?? ???????.
???????????? ???? ?? ??????????? ????????? ??
??????????? - Load ??????? ?? ?????????? ??? ???????
????????? ?? ???????. ????? ?? ?????? ??
?????????????? ?? ???????????
32??????? ????????
- TextBox ???? ?? ????????? ?? ?????.
??-????? ???????? - Multiline ?????? ???? ?? ?? ??????? ?????????
?? ??????? ???? - Text (Lines) ??????? ????????? ?????
- Label ?????????? ????? ???
???????. ????? ???????? - Text ???????, ????? ?? ??????????
- Button ????? ?? ?????????
??-????? ???????? ? ??????? - Click ???????? ?? ??? ?????????
- Text ?????? ?????? ????? ??????
33????????? ?? ????????
- ??????????? ?? ???????? ??? ??????? ????? ????
Controls.Add - ????? ?? ?????????? (?. ???. z-order) ?? ????????
?? ???? ?? ??????????? ?? (?????????? ???????? ?
???-??????) - Windows Forms ?????????? ?? Visual Studio .NET ??
????? ?? ?????????? ????????? ?? ??????????
Form form new Form() Button button new
Button() button.Text "Close" form.Controls.Add
(button)
34?????????? ?? ?????????
- ???????????? ?? ??????? ????? ????
- Windows Forms ?????????? ?? Visual Studio .NET
???????? ??????????? ????????????? ?? ???????
Form form new Form() Button button new
Button() button.Click new EventHandler(
this.button_Click) ... private void
button_Click( object sender, EventArgs e)
// Handle the "click" event
35?????????? ?? ?????????
- ?????? ??????? ? Windows Forms
- EventHandler ?????? ???????????
- ??? ???????????? ?????
- KeyEventHandler ??????? ?? ????????????
- ?????? ?? ??? ? ??????????? ?????? ? ???????????
?? Ctrl, Shift ? Alt - MouseEventHandler ??????? ?? ???????
- ?????? ?? ????????? ?? ??????? ? ??????????? ??
???????? ? - CancelEventHandler ???????, ????? ????? ??
??????? ????????? ????????
36????? ?????????? ??????
using System using System.Drawing using
System.Windows.Forms public class
CalculatorForm Form private TextBox
TextBoxNumber1 private TextBox
TextBoxNumber2 private TextBox TextBoxSum
private Button ButtonCalc private Label
LabelPlus private Label LabelEquals
public CalculatorForm()
TextBoxNumber1 new TextBox()
TextBoxNumber1.Bounds new Rectangle(
new Point(16, 16), new Size(72, 20))
TextBoxNumber1.MaxLength 10 (????????
??????????)
37????? ?????????? ??????
LabelPlus new Label()
LabelPlus.AutoSize true
LabelPlus.Location new Point(94, 19)
LabelPlus.Text "" TextBoxNumber2
new TextBox() TextBoxNumber2.Bounds
new Rectangle( new Point(112, 16),
new Size(72, 20)) TextBoxNumber2.MaxLengt
h 10 LabelEquals new Label()
LabelEquals.AutoSize true
LabelEquals.Location new Point(191, 18)
LabelEquals.Text "" TextBoxSum
new TextBox() TextBoxSum.Bounds new
Rectangle( new Point(208, 16), new
Size(72, 20)) TextBoxSum.ReadOnly
true (???????? ??????????)
38????? ?????????? ??????
ButtonCalc new Button()
ButtonCalc.Bounds new Rectangle(
new Point(16, 48), new Size(264, 23))
ButtonCalc.Text "Calculate sum"
ButtonCalc.Click new EventHandler(
this.ButtonCalc_Click) this.AcceptButton
ButtonCalc this.ClientSize new
Size(298, 87) this.Controls.Add(TextBoxNu
mber1) this.Controls.Add(LabelPlus)
this.Controls.Add(TextBoxNumber2)
this.Controls.Add(LabelEquals)
this.Controls.Add(TextBoxSum)
this.Controls.Add(ButtonCalc)
this.FormBorderStyle
FormBorderStyle.FixedDialog
this.MaximizeBox false
this.MinimizeBox false this.Text
"Calculator" (???????? ??????????)
39????? ?????????? ??????
private void ButtonCalc_Click( object
aSender, EventArgs aArgs) try
int value1
Int32.Parse(TextBoxNumber1.Text) int
value2 Int32.Parse(TextBoxNumber
2.Text) int sum value1 value2
TextBoxSum.Text sum.ToString()
catch (FormatException)
TextBoxSum.Text "Invalid!"
TextBoxNumber1.SelectAll()
TextBoxNumber2.SelectAll() (???????? ??????????)
40????? ?????????? ??????
TextBoxNumber1.Focus() static
void Main() CalculatorForm CalcForm
new CalculatorForm()
Application.Run(CalcForm)
41???????????? 2
42Windows Forms ? VS.NET
- Windows Forms ?????????? ?? VS.NET ?????????
- ????????? ?? ?????
- ???????? ?? ????????
- ???????? ?? ?????????? ??????????
- ????????? ?? ??????????
- ???????? ?? ???????
- ????????? ?? ?????
43Windows Forms ? VS.NET
- ???????? ?? ????????
- ???????? ?? ?????????? ??????????
44Windows Forms ? VS.NET
- ???????? ?? ??????????? ?? ???????
45???????????? 3
- ????????? ?? ????? ?????????? ? Windows Forms
????????? ?? VS.NET
46?????????? ????????? ?????
- ?????? MessageBox ????????? ????????? ??
?????????? ????????? ????? - ????????? ??? ???????????
- ???????????? ???????
- ???????
MessageBox.Show("???? ?????? ? ????????.",
"??????????????")
bool confirmed MessageBox.Show("???????? ?? "
"?? ???????? ?????", "??????",
MessageBoxButtons.YesNo, MessageBoxIcon.Question
) DialogResult.Yes
47????????? ?? ????????? ?????
- ??????????????? ????????? ????? ?? ???????? ????
- ShowDialog() ??????? ??????? ???????
- ????? DialogResult ??????? ????????? (OK, Yes,
No, Cancel ? ??.) - ???????? ?? DialogResult
- ??????????? ???? ?????????? DialogResult ??
???????? - ????? ????? ????????? ?? ??????? ????
?????????? ?? DialogResult
DialogResult result dialog.ShowDialog()
48????????? ????? ??????
49???????????? 4
- DialogResult ? ????????? ?? ????? ????? ???????
50????? Windows Forms ????????
- CheckBox ????? ?? ????? ? ????
"??/??". ??-????? ???????? - Checked ?????? ???? ? ???????
- RadioButton ???????? ??
???????????? ????? - Checked ?????? ???? ? ???????
- CheckedChanged ???????? ?? ??? ??????? ??
Checked ??????????
- ???????? ?? ? ?????
- ???? ???? RadioButton ? ?????? ? ????? ??????
- ???????? ?? ? GroupBox, Panel ??? TabPage
51????? Windows Forms ????????
- PictureBox ?????????? ????????. ??-?????
???????? - Image ?????? ??????????
- SizeMode ?????? ???? ?????????? ?? ?? ??????? /
?????? ??? ???????? - Panel ???????????? ?????????, ????? ???????
????? ????? ???????? - TabControl, TabPage ?????????? ???????? ??
?????? ??? ????????
52????? Windows Forms ????????
- ListBox ?????????? ?????? ? ??????. ??-?????
???????? - Items ?????? ???????
- SelectionMode ????????? / ????????? ???????????
?? ??????? ???????? ???????????? - SelectedIndex, SelectedIndices, SelectedItems
????? ???????? ??????? (??? ????????? ????????) - CheckedListBox ?????? ?? ??????????? ?? ?????
"??/??" - Items ?????? ?????????????
- CheckedItems ????? ?????????
53???????????? 5
54????? Windows Forms ????????
- ComboBox ????? ?? ???????? ?? ????? ?
?????????? ?? drop-down ???????????? ?????.
??-????? ???????? - Text ????????? ?????
- Items ???????? ?????????
- DropDownStyle ?????? ???? ???? ???? ?? ??????
???????? ?? ??????? ??? ???? ?? ?? ??????? ?????
???????? - TreeView ?????????? ?????????? ?????. ???????
???????? - Nodes ??????? ??????? (?????? ?? TreeNode
??????) - SelectedNode ???????? ?????
55????? Windows Forms ????????
- LinkLabel ?????????
(hyperlink) - Text ?????????? ?? ????????
- LinkClicked ???????? ?? ??? ???????? ?????
??????????? - RichTextBox ????? ?? ???????? ?? ????? ?
??????????? (Rich Text Format) - LoadFile, SaveFile ???????/??????? RTF
- SelectionFont, SelectionColor, SelectionAlignment
??????? ?????, ???? ? ???????????? ?? ????????
?????
56??????
- MainMenu ??????
???? - ??????? ?????? ?? MenuItem ????????
- MenuItem ??????? ?? ????
- Text ???????? ?? ????????, ???????? New ???
Open ??? - ShortCut ?????? ??????
- Click ??????? ????????
- ContextMenu ?????????? ???? (popup ????)
- ??????? ?????? ?? MenuItem ????????
57????? ? ???????????
- ToolBar ????? ? ??????????? (? ??????)
- Buttons ??????? ?????? ?? ToolBarButton
???????? - ImageList ?????? ?????????? ?? ????????
- ButtonClick ???????? ?? ??? ????????? ?? ?????
- ?????? ?? ToolBarButtonClickEventArgs ?
?????????? ??? ????? ? ??? ???????? - ToolBarButton ????? ? ???????
- ImageList ?????? ? ????????
58?????? ?????
- StatusBar ?????
?? ??????????? - Panels ??????? ???????? ?? ???????
- ShowPanels ??????? / ???????? ????????? ??
???????? - StatusBarPanel ?????? ? ???????
- Text ?????????? ?? ??????
- Icon ????? ?? ??????
59?????? ?? ????? ?? ????
- OpenFileDialog ?????? ?? ????? ?? ???? (???
????????) - Title ???????? ?? ???????
- InitialDirectory ??????? ??????????
- Filter ?????? ?????????? ??????? ??????????
- FilterIndex ?????? ???????? ??????
- Multiselect ????? ?? ????? ???????
- FileName, FileNames ???????? ????
- SaveFileDialog ?????? ?? ????? ?? ???? (???
?????????)
60?????? ?????? ??????
private void ButtonLoadFile_Click( object
sender, System.EventArgs e) OpenFileDialog
openFileDialog new OpenFileDialog()
openFileDialog.Filter "Text files
(.txt).txt" "Log files
(.log).log" openFileDialog.Title
"Choose text file" if (openFileDialog.ShowDi
alog() DialogResult.OK) string
fileName openFileDialog.FileName using
(StreamReader reader
File.OpenText(fileName))
string fileContents reader.ReadToEnd()
textBox.Text fileContents
61???????????? 6
62MDI ??????????
- MDI (Multiple Document Interface) ????????????
????????? ?????? ? ??????? ????????? ???????????? - MDI ?????????? (MDI parents)
- ???????? ????? ?????
- ?????? ?? ?? IsMdiContainer true
- ?????????? ???? ???? Window ?? ????? ?? ?????????
????? (MdiList true) - MDI ??????? (MDI children)
- ???????? ?? ? ?????????-???????
- ?????? ?? ?? MdiParent lt?????????gt
63???????????? 7
- ??????????????? ??????? ????????
64????????? ?? ?????
- ??????????? ? ??????????, ?????? ? ??????
???????? ?????? ?? ?? ??????? ????????? ???? ??
???????? ????? - ? Windows Forms ??? ?????????? ???????? ??
????????? - Validating ??????? ?? ????????? ?? ??????? ?
????? Control - ?????? ?? ????????? ?? ??? CancelEventArgs
- ??? ?? ?????? Canceltrue ?? ????? ???????????
?? ??????? ?????????? - ErrorProvider ????????? ???????? ???????? ?
????????? ?????
65????????? ?? ????? ??????
private TextBox TextBox1 private ErrorProvider
errorProvider ... private void
TextBox1_Validating(object sender,
System.ComponentModel.CancelEventArgs e)
try Int32.Parse(TextBox1.Text)
errorProvider.SetError(TextBox1, "")
catch (FormatException)
errorProvider.SetError( TextBox1,
"Integer number expected!") e.Cancel
true
66???????????? 8
67????????? ?? ?????
- ??????????? ?? ??????? (Data Binding)
- ????????? ??????????? ??????????? ?? ????? ?????
???????? ? ????????? ?? ????? - ???????? ????????? ?? ????? ???????? ????? ??
??????? ? ComboBox ???????? - ????????? ?? ?????
- IList ?????? ? ????????
- IBindingList ???????? ?? ?? DataView
- ???????? ??????????? ?? ???????
- ????????, ?????????? data binding
- ?????? Windows Forms ????????
- TextBox, ComboBox, ListBox, DataGrid
68????????? ?? ?????
- ?????? ?????????
- ?????? ????????? (simple binding)
- ????????? ?? ???????? ? ???????? ?????
- ????????? ?? ???????? ? ???????? (?????) ???????
?? ?????? - ???????? TextBox ? CheckBox
- ?????? ????????? (complex binding)
- ????????? ?? ???????? ???????? ??? ??????
- ???????? ListBox, ComboBox, DataGrid
- ???????? ?? ?????? ?????? ??????? (???????) ??
???????
69??????????? ? ???????????!
- ??????? ?? ?????? ???????? ???????? ?? ??????
???????? ??????? ??????? ? ?????????, ??? ?????
?? ? ???????? - ????????? ?? ? ?????!
- ??? ??????? ?? ????????? ?? ????? ?????????? ???
???? ???????? ?? ?? ???????? ?????????? - ???? ??????? ?? ??????? ? ????????? ?? ????? ??
?????????? ?? ????????? ? ?????????? ? ????
???????? ?? ????? - ?????????? (?????????) ?? ???????????
- ???????? ?? ??????????? ??????
70?????? ?????????
- ????????? ?? ???????? ??? ?????
- ??? ??????? ?? TextBox1.Text ?? ???????
?????????? ?????
class Customer private string mName
public string Name get return
mName set mName value
Customer cust new Customer() cust.Name
"??? ????" TextBox1.DataBindings.Add( new
Binding("Text", cust, "Name"))
71???????????? 9
- ????????? ?? ???????? ??? ?????
72?????? ?????????
- ????????? ?? ???????? ??? ??????
- ????????? ?? ???????? ??? ???????
string towns "?????", "???????",
"?????" TextBoxTowns.DataBindings.Add( new
Binding("Text", towns, ""))
// ????? DataSet ds ? ??????? Towns ? ?????? id ?
name DataTable towns new DataTable("Towns") to
wns.Columns.Add(new DataColumn("id",
typeof(int))) towns.Columns.Add(new
DataColumn("name", typeof(string))) DataSet ds
new DataSet() ds.Tables.Add(towns) TextBoxTowns
.DataBindings.Add( new Binding("Text", ds,
"Towns.name"))
73?????? ????????? ? VS.NET
- ??????????? ???? ?? ????? ? ?? ????? ?? ?????? ?
VS.NET (??? ?????????? ?? ???????? DataSet)
74BindingContext
- ??????? ???? ?????????? ?? ?????????? ???????? ?
???? BindingContext ????? - CurrencyManager ?? ???????? ???????? ???
??????. ??????? ????????? ? ??????? - PropertyManager ?? ???????? ???????? ??? ?????
CurrencyManager
Array
CurrencyManager
Collection
BindingContext
Form
CurrencyManager
DataTable
PropertyManager
Object
75????????? ? CurrencyManager
- CurrencyManager ?????? ???? ???????? ??????? ?
??????? ???????? ?? ????? - Position ??????? ?????????
- Count ??????? ??????? ?? ???????
- ????????? ?? ????????? ?? ?????
- ????????? ?? CurrencyManager ??????
- ????????? ?? ???????
CurrencyManager cm (CurrencyManager)
textBox1.DataBindings"Text".BindingManagerBase
// ???? ? ???? CurrencyManager cm
(CurrencyManager) form1.BindingContextdataTab
leCustomers
cm.Position
76???????????? 10
- ????????? ?? ???????? ??? ?????? ? ????????? ??
???????
77?????? ?????????
- ????????? ?? ???????? ??? ??????
- ???????? ?? ??? ???????? ????????
- ListBox, ComboBox ? ??.
- ??????? ?? ??????????
- DataSource ?????? ? ???????
- DisplayMember ??? ?? ??????, ????? ?? ??
??????????? - ValueMember ??? ?? ??????, ?? ????? ?? ????????
????????? - ??????
comboBox1.DataSource dataSetCountries
comboBox1.DisplayMember "Countries.CountryCode"
comboBox1.ValueMember "Countries.Name"
78???????????? 11
- ?????? ????????? ?? ???????? ??? ??????
79?????? ????????? ? VS.NET
- ??????????? ???? ?? ????? ? ?? ????? ?? ?????? ?
VS.NET (??? ???????? ?? ???????? DataSet)
80?????????? DataGrid
- DataGrid ?????????? ??????????? ???????? ?????
- ????????? ????????? ?? ?????? ? ??????
- ????????? ??????????? ?? ???????
- ????? ??????????????
- ?? ???? ???????? ? ?????? ?????? ?? .NET
Framework - ???????? ?? ???-????? ? ADO.NET DataSet ?
DataTable - DataSource ?????? ????????? ?? ?????
- DataMember ?????? ???? ?? ??????? ? ??????? ??
?????????
81DataGrid ??????
private void MainForm_Load( object sender,
System.EventArgs e) // Create table
"Towns" DataTable towns new
DataTable("Towns") towns.Columns.Add(
new DataColumn("id", typeof(int)))
towns.Columns.Add( new DataColumn("name",
typeof(string))) // Add some rows in the
table DataRow row towns.NewRow()
row"id" 1 row"name" "?????"
towns.Rows.Add(row) row towns.NewRow()
row"id" 2 row"name" "???????"
towns.Rows.Add(row)
82DataGrid ??????
row towns.NewRow() row"id" 3
row"name" "?????" towns.Rows.Add(row)
row towns.NewRow() row"id" 4
row"name" "????" towns.Rows.Add(row)
// Add table "Towns" to the DataSet
DataSet ds new DataSet()
ds.Tables.Add(towns) // Bind the DataGrid
to the DataSet DataGridTowns.DataSource
ds DataGridTowns.DataMember "Towns"
83???????????? 12
- ?????? ? DataGrid ??????????
84?????????? DataGrid
- ??-????? ???????? ?? DataGrid
- ReadOnly ????????? / ????????? ????????
- CaptionVisible ??????? / ?????? ??????????
- ColumnHeadersVisible ??????? / ??????
?????????? ?? ???????? - RowHeadersVisible ??????? / ?????? ????????
????? ?? ???????? - TableStyles ?????? ??????? ?? ?????????
- ??????? ? ???? ??????? ????
- MappingName ?????? ?????????, ?? ????? ??
?????? ???????????? ???? - GridColumnStyles ?????? ????????????? ??
????????? ?????? ????????, ?????? ? ??.
85???????????? 13
- TableStyles ?????????? ?? ??????? ?? DataGrid
??????????
86Master-Details ?????????
- Master-Details ??????????? ????????
??????????????? ??? "1 ??? ?????" - ???????? 1 ?????? ??? ????? ???????
- ? ADO.NET DataSet ???????? ?? ????????? ???????
??? "??????/????????" - ????????? ?? DataRelation ???????? ? DataSet
- Windows Forms ???????? Master-Details ?????????
- ?? ???????? ???????? ?? ?????? ?? ???????? ??
??????? ???????? ??????? - ?? ??????????? ???????? ?? ?????? ?? ???????? ??
??????? ????????? ?? ????????? - ?????????? ?? ???????? ? ???? ? ??? DataSet
87Master-Details ??????
// Bind the master grid to the master
table DataGridCountries.DataSource
datasetCountriesAndTowns DataGridCountries.DataMe
mber "Countries" // Bind the detail grid
to the relationship DataGridTowns.DataSource
datasetCountriesAndTowns DataGridTowns.DataMembe
r "Countries.CountriesTowns"
88???????????? 14
89??????? "????? ??? ?????"
- ??????? ??? "????? ??? ?????" ?? ?? ????????? ??
DataSet ? DataGrid - ????? ?? ????? ??????? ?? Master-Details ????
???????? ?? ?????? ? ?????? ?? ?????
CREATE VIEW View_StudentsCourses AS SELECT
StudentId, StudentName, CourseId, CourseName
FROM Students, Courses, StudentsCourses WHERE
Students.StudentsId StudentsCourses.StudentId
AND Courses.CourseId StudentsCourses.CourseId
90??????? "????? ??? ?????"
91??????????? ?? ?????
- ????????????? ?? ?????
- ????????? ???????? ?????????? ?? ????? ??
?????????????? ????????? - ???????? ? ?? ?? ???????? ???????? ?????? ?????
?? ????? ????? - ???? ??????? ?? ???????? DLL ???? ???? ?? ??
???????? ?????? ????? - ???????-?????????? ????? ?? ???????
?????????????? - ????????? ?????? ????? ?? ?????????? ????????????
?? ???????????? ??????????????, ???????? ??
???????? ?????
92??????????? ?? ?????
- ???????? ????? ? ???-?????????? ?????
- ??????????, ????? ????? ?? ?? ????????, ?? ??????
???? protected - ?????????? ???????? ?? ????? ?? ?? ???????? ??
???????-?????????? - ?? ??????????? ?? ????? ?? ????????? ?????? ??
???????? ????? - ???????-?????????? ?? ???????? ?? ?? Visual
Studio .NET (???? File Add New Item
Inherited Form) - ??? ??????? ?? ???????? ????? ???????????? ??????
?? ?? ????????????
93???????????? 15
94????????? ? System.Drawing
- System.Drawing ????????? ?????? ?? GDI ?????????
?? Windows - ??????????? ?? ???????
- ?????? ? ??????? ? ???????? ?????????????
- ??????????? ?? ??????????? ??????
- ?????? ? ???????????
- ?????? ? ????? ? ????????
- ???????? ?? ???????
95??????? System.Drawing
- System.Drawing ?? ?????? ??
- System.Drawing
- ??????? ???????
- ???????????, ??????, ?????
- ??????? ??????????? ??????
- ???????????? ?? ?????
- System.Drawing.Imaging
- ?????? ? ???????????
- ???????? ? ?????
- ?????? ? ????????? ? ???????? ??????? ???????
- ???????????? ?? ???????????
96??????? System.Drawing
- System.Drawing ?? ?????? ??
- System.Drawing.Drawing2D
- ???????? ?????????????
- ??????, ??????? ? ??.
- System.Drawing.Text
- ?????? ?? ??????????
- System.Drawing.Printing
- ???????? ?? ???????
- ???????? ????????? ????? ?? ????????
97?????? Graphics
- ?????? System.Drawing.Graphics
- ?????????? ?????????? ?????????? ?? ???????
- ???-????? ????????? ?? ???????? ? ??????????? ??
????????? Paint - Paint ???????????? ?????????? ??? ????????????
- ??????????? PaintEventArgs ??????? Graphics
?????? - ???? ?? ?? ??????? ???? Control.CreateGraphics()
- ?????? ?? ?? ??????????? ???? finally ???? ??? ?
????????????? using
98System.Drawing ??????
private void MainForm_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
Graphics g e.Graphics g.SmoothingMode
SmoothingMode.AntiAlias Brush blueBrush
new SolidBrush(Color.Blue)
g.FillEllipse(blueBrush, 50, 40, 350, 250)
blueBrush.Dispose() Pen redPen new
Pen(Color.Red, 2) g.DrawRectangle(redPen,
40, 50, 200, 40) redPen.Dispose() Brush
brush new SolidBrush(Color.Yellow) Font
font new Font("Arial", 14, FontStyle.Bold)
g.DrawString(".NET Rulez", font, brush, 60, 60)
brush.Dispose() font.Dispose()
99???????????? 16
- ?????? ??? System.Drawing
100???????????? 17
- ???????? ??? System.Drawing
101???????? ?? ???????
- ????????? ?? 3 ??????? ?????
- PrintDialog
- ?????????? ?????? ?? ???????? ?? ???????
- PrintController
- ????????? ??????? ?? ???????? ? ???????? ???????,
???????? ? ???? - ?????????? Graphics ????????????
- PrintDocument
- ?????? ???????????????? ?? ???????????? ????????
- ??????? PrinterSettings ??????? ?? PrintDialog
102????????????? ????????
- ??????????????? ???????? (custom controls)
- ?????????? ??????????? ?? ??????????? ????? ??
???????? ???? - ??????????? ?? ????? ???????? ? ????
- ??????????? ? ????????? ?? ????????
- ????????? ?? ?????? ???? ????????
- ????? ?? ?????????? ??????????? ??
- ?? ????? ?? ?????? ?????????????? ? ?????????
?? VS.NET - ?? ????? ?? ??????????
- ?????????? ???????????? ????????, ????? Control
??? UserControl
103????????? ?? ????????
- ????????? ?? ???? ????????, ????? ?? ?????????
????? ???????????? - ?? VS.NET ? New Item ? Custom Control
- ??????????? ????? Control
- ???????????? ?????????? ????? OnPaint() ?? ??
??????? ?????????? - ?????????? ???????????? ???????? ? ??????
- ????????? ??????????, ???????? ?? ????????? ????
???????? - Category ????????? ? ?????????
- Description ???????? ?? ??????????
104????????? ?? ???????? ??????
public class ClockControl System.Windows.Forms.C
ontrol private int mHour private int
mMinute Category("Behavior"),
Description("Specifies the hour.") public
int Hour get
return mHour set
mHour value
this.Invalidate() (????????
??????????)
105????????? ?? ???????? ??????
Category("Behavior"),
Description("Specifies the minutes.") public
int Minute get return mMinute
set mMinute
value this.Invalidate()
private const int DEFAULT_SIZE 100
public ClockControl() this.Size
new Size(DEFAULT_SIZE, DEFAULT_SIZE)
mHour DateTime.Now.Hour mMinute
DateTime.Now.Minute (???????? ??????????)
106????????? ?? ???????? ??????
protected override void OnResize(System.EventA
rgs e) this.Height this.Width
this.Invalidate() protected
override void OnPaint(PaintEventArgs pe)
Graphics g pe.Graphics // Draw
the clock circle Pen pen new
Pen(Color.Blue, 1) g.DrawEllipse(pen, 0,
0, this.Width-1, this.Height-1)
// Draw the minute finger and the clock
finger // ...
107???????????? 18
- ????????????? ???????? "????????"
108????????? ?? ????????
- ????????? ?? ???? ????????, ???? ?????????? ??
????? ???????? - ?? VS.NET ? New Item ? User Control
- ?????????? ????????? ?? VS.NET
- ????????? design-time ?????????? ???? ??????????
Category ? Description - ????????? ?? ???? ????????, ????? ?????????
???????????? ???????? - ?? VS.NET ? New Item ? Inherited User Control
- ?????????? ?????????????? ???????? ? ?????? ? ??
????????? ?? VS.NET ????????? - ???????????? OnXXX() ???????? ??? ????????????
109??????? ?? ???????? ? IE
- Internet Explorer ???? ?? ????????? Windows Forms
???????? ???????? ? ?????? ?? HTML ???????? - ???????????? ? ??????? ?? Java ???????? ???????
?? ???????? ??? - ?????????? ??
- Internet Explorer 5.5 ??? ??-???
- .NET Framework
- ??????????? ?? ????????? ?? ?????????? ?????? ??
????????? ??????? ? ????? ?????? ???????? - ??????????? ???? ?? ?? ?????? ?????
110??????? ?? ???????? ??????
lthtmlgt ltscriptgt function ChangeText()
clockControl.Hour hour.value
clockControl.Minute minute.value
lt/scriptgt ltbodygt ltpgtClock Control in
IElt/pgt ltobject id"clockControl"
classid"httpDemo-18-CustomControl-Clock.exeDemo
_18_CustomControl_Clock.ClockControl"
width"200" height"200"gt ltparam
name"Hour" value"14"gt ltparam
name"Minute" value"35"gt lt/objectgt (????????
??????????)
111??????? ?? ???????? ??????
ltbrgt ltbrgt Hourltinput type"text"
id"hour"gtltbrgt Minuteltinput type"text"
id"minute"gtltbrgt ltinput type"button"
value"Update the clock"
onclick"ChangeText()"gt lt/bodygt lt/htmlgt
- ?? JavaScript ????? ?? ?? ????????? ?????????? ??
Windows Forms ??????????
112???????????? 19
113????? ? Windows Forms
- ? Windows Forms ???????????? ???????????????
???????? ?????? ?? ?? ?????????? ? ??????? ????? - ? ???????? ?????? ?? ???????? "?????????" ??
?????????????? ????????? - ???????????? ?? ?????????????? ????????? ??????
?? ????? ???? ?? ???????, ? ????? ?????? ???????? - ?????? ?? ??????????? Windows Forms ???????? ??
?????, ????? ?? ?? ????????? - ?? ????? ????? ???? ?? ?? ???????? ???? ????????
Invoke(), BeginInvoke(), EndInvoke() ?
CreateGraphics()
114????? ? Windows Forms
- ??????????? Invoke() ?????? ?? ????? Control ??
?????????? ?? ?????? ?? ???????, ????? ?????????
??????????
delegate void StringParamDelegate(string
aValue) class Form1 System.Windows.Forms.Form
private void UpdateUI(string aValue)
// Update UI here void
AsynchronousCalculation() // This
runs in separate thread. Invoke UI update
this.Invoke(new StringParamDelegate(UpdateUI),
new object"??????? ?????????")
115???????????? 20
- ?????????? ?? ????? ? Windows Forms ??????????
116??????? (Drag and Drop)
- ? ??????????-????????
- ? ????????? MouseDown ?????? DoDragDrop() ?? ??
???????? ??????? - ? ??????????-?????????
- ???????? AllowDrop true
- ?????????? ????????? DragEnter
- ??????????? ??????? ?? ???????? ????? ?
??????????? / ??????????? ???????????? - DragEventArgs.Data.GetDataPresent()
- ?????????? ????????? DragDrop
- ??????????? ?????????? ?????
- DragEventArgs.Data.GetData ()
117??????? ??????
private System.Windows.Forms.ListBox
ListBoxSource private System.Windows.Forms.ListBo
x ListBoxTarget private void ListBoxSource_Mouse
Down(object sender, System.Windows.Forms.Mouse
EventArgs e) Point mousePos new
Point(e.X, e.Y) int selectedIndex
ListBoxSource.IndexFromPoint(mousePos) if
(selectedIndex ! -1) string data
(string) ListBoxSource.ItemsselectedI
ndex ListBoxSource.DoDragDrop(data,
DragDropEffects.Copy) (????????
??????????)
118??????? ??????
private void ListBoxTarget_DragEnter(object
sender, System.Windows.Forms.DragEventArgs
e) if (e.Data.GetDataPresent(
DataFormats.UnicodeText)) e.Effect
DragDropEffects.Copy private void
ListBoxTarget_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
string data (string) e.Data.GetData(
DataFormats.UnicodeText) ListBoxTarget.Items.
Add(data)
119???????????? 21
- ??????? ? ??????? ? Windows Forms
120??????????????? ????
- .NET Framework ???????????? ????? ?? ?????????
??????????????? ???? ?? ?? ????? ??????????? ?? - ?? VS.NET ????? ?? ??????? ??????????????? ????
- File Add New Item Application configuration
file App.config - ??? ??????????? App.config ?? ?????? ??? ???
lt???_??_???????.exe.configgt - ?? ????? ?? ?????????? ??????????? ??
???????????????? ???? ????? ?? ????? ?????????
121??????????????? ???? ??????
- ???????? ??????????????? ????
- ????????? ?? ????????
string username System.Configuration.
ConfigurationSettings.AppSettings"username" //
username "??? ????"
122???????????? 22
- ????????? ?? ????????? ?? ??????????????? ????
123Windows Forms
????????
124??????????
- ????? ???????????? ???????????? Windows Forms?
????? ?????????????? ??????????? ???? ??
????????? - ????? ? ?????????? ????? ????????????
????????????? ????? .NET Framework? ????? ?
?????????? ?? ????? - ??????? ?????????? ????? ?? Windows Forms. ?????
?????????????? ????????? ???? - ??? ?? ???-??????? ??????? ?? Windows Forms? ???
?? ???-??????? ?? ?????? ? ????????? - ????? ? ?????????? ?? ?????? Windows Forms
????????? ??? ?? ?????? ?? ?????? ? ????????? - ????? ? ?????????? ?? ??????? ? Windows Forms?
????? ???????? ???? ???
125??????????
- ??? ?? ???????? ???????? ? ?????? ?????? ??? ??
????????? ???????, ???????? ?? ????? ???????? - ???????????? Windows Forms ??????????, ?????
???????????? ???????? ??????? ?? ???????????
?????????? ? Windows. ???????????? ?????? ??
???????? ????????? ??????????? ???????? ? ???? ?
?????? ?????. - ??? ?????????? ?? Windows Forms ????????????
?????? "????? ??????? ?????". ?????? ????????????
???? ?????, ? ????? ??? ???? ????? ??? ????????
"??????? ??". ??? ???????????? ?? ??????? ??
??????? ? ??????? ?? ?????? ??? ?????? ?? "????
?? ????" (?? ?? ????????? ?? ????? ????? ???
???????, ???????? ??-?????? ?? ??????? ??
???????).
126??????????
- ??? ?????????? ?? Windows Forms ????????????
?????? ????????????? ??????? ?? ?????????? ??
????????? ?? ?????? ?????. ????????? ?????? ??
??????????? ?????? ?? ??????? (ListBox) ? ??
????????? ????????, ??????????? ? ????????? ??
???????. ????? ?????? ? ??? ?????????? ???
????????? ????. ???????????? ???? ?? ??????? ?
????????????, ??? (??, ??, ???, ?????????, ...),
???????, ??????? ?????, ?????, ???????, email,
Web-???? ? ??? (????? ? ????????? ????).
??????????? ???? ?? ??????? ? ???, ???????,
???????, ???, ???, ????? ?? ????? ?????, ?????,
??????? ? email. ???????????? ?????? ?? ?? ??????
?? 3 ????? ?????? ?????, ????????? ?????????,
????? ?? ?????????/???????? ?? ?????????? ???? ?
????? ?? ?????????/???????? ?? ????????? ????.
??????????? ????????? Windows Forms ???????? ???
???????. ??????? ?????? ?? ?? ????? ? ???????? ?
XML ????.
127??????????
- ??? ?????????? ?? Windows Forms ????????????
????????????? ???????? ?? ?????????? ? ????????
?????????. ???? ?????????? ????????????
?????????? ?? ???????? ?????????, ????????????
?????????? ? ?????. ? ???? ????? ???? ?? ???
????????? ? ????? ????? (??????? ?? ?????????
??????? ?? Windows). ????? ???????? ????????????
??????? ????? ? ???????????. ?????????? ?????? ??
???? ?? ??????? ??????????, ?? ????/???????
?????????? ??/??? XML ????. ?????? ? ????????
?????? ??????????, ?????????? ?????? ?? ?????????
??????????? ?? ??????????? ? ??? (??????? ??
?????? ? ????????????? ?? ??????? ????????? ??
????), ????? ? ?????????/?????????/????????????
?? ????? ? ?????????. (???????????? ??????????)
128??????????
- ?? ??????? ? ??????? ?????? ?? ?? ????????
?????????? TreeView, ? ?? ???????? ???????? -
RichEdit. ?????????? ?????? ?? ????????? ? ??????
????, 2 ?????????? ?????? (?? ??????? ? ??????? ?
?? ?????? ?? ??????????? ?? ????????), 3 ????? ?
??????????? (?? ????????/????????? ?? ??????????,
?? ?????? ? ??????? ? ??????? ? ?? ??????????? ??
???????? ? ??????? ????????), ?????? ????? ?
????????? ?????? ??????? ?? ??-??????? ???????.
???????????? ? ??????? ? ???????? ?? ????? ?
???????????. - ???????? Windows Forms ??????????, ? ????? ??
??????? ?????????? ?? ????????? ???? (???,
???????, ???????, ???, ?????, ???????, email,
????? ????) ? ?????????? ?? ??????? ? XML ????.
???????????? ????????? ?? ????? ???? ?? ????????
? ?? ?????? ?????, ???? ?????????? ?????????
????????? ??????.
129??????????
- ??? ?????????? ?? Windows Forms ? ????????
????????? ?? ????? (simple data binding)
???????????? ?????????? ?? ?????????? ?? ??????
??????? ? ?????????? ?? ??????? ? ???????. ?????
??????? ?? ?????? ? ???, ????, ?????????,
?????????? ???? ? ?????? ?? ???????. ????? ????
?? ?????? ?? ???, ????????? ? ???????. ?????? ??
?? ????????? ????????? ?? ????????? ? ????????? ?
???????? ?? ???????????? ?? ???, ???? ?? ??
????????? ???????? ????????, ? ???? ????????
?????? ? ?????? ?????????. ?? ?? ????????? ??????
? ????????? ?? ??????? ? XML ????.
130??????????
- ??? ?????????? ?? Windows Forms ? ????????
????????? ?? ????? (complex data binding)
???????????? ???????, ??????? ?? ????????? ??
?????????? ?? ?????????? ?? ??????? ? ???????.
???????? ??? ????????? ?????? ?? ?????????? ??
????? ???????. ?? ?????????????? ? ???????????
??????????? ??????? (DataGrid) ? ????????
????????. ???????????? ??????????? ??????????
???? ??????????? ??????? ?? ? XML ????, ? ?
?????????? ???? ?? ????? (????. MS SQL Server).
??????????? ?????????? ????? ?? ?????? ?? ???????
(disconnected model) ???? ??????????? ??????????
?? ??????????? ?? ???????????, ????? ?????????
??? ?????? ? ????? ??????????? ????????????.
131??????????
- ???????? Windows Forms ??????????, ? ????? ?????
?? ?? ???????? ????? ?? ????????? ? ??????????
????. ??????????? ???? ?? ??????? ? ???, ???,
?????, ???????, email ? Web-????. ????????????
???? ?? ??????? ? ????????????, ??? (??, ??, ???,
?????????, ...), ???????, ??????? ?????, ?????,
???????, email ? Web-???? ? ??? (??? ? ??? ??
????????? ????). ??????????? ??????????? ??
?????, ???? ???????? ? ?????? ????? ??????
???????? ?? ?????????????? ????????? ? ??????
?????? ?? ??????? ?? ????????? ?? ????????? ?
?????????? ????.
132??????????
- ???????????? Windows Forms ??????????, ????? ??
??????????? ????? ?? ?????? ?????????? ?????????
?? ????? ?????? (??????? ???? ? ???? ???????????
?????) ??????????? ???????? ??????????? ????
?????? ?? ??????????? ????????. ??? ?????? ?????
????????? ?????????? ?? ?????????? ?? ?????????. - ??? ?????????? ?? Windows Forms ????????????
?????? "?????? ???" (? ????????? ????? ? ???????
3 ?? 3 ?? ???????? ?????? "X" ? "0"). ???????
?????? ?? ???? ?? ????? ????? ????????? ? 2
?????? "?????????? ????? ?????????" ?
"?????????? ????? ???????? (????????)". ?????????
????????? ???????????? ? ?????????????? ??
??????.
133??????????
- ???????????? Windows Forms MDI ??????????, ?????
???? ?? ?????? ??????? ? ???????? ???????????
(gif, jpg, png) ? ???? ?? ?? ????????????? ? ??
?? ??????? ? ???? ????. - ???????????? Windows Forms ??????????, ?????
??????? ????? ??????? ????, ???? ???????????
????? ????? ??? ??? ????????? ????? ????? ?????
???????????? ?? ??????? ?? ???????? ????? ???
??????? ? ??????? ?? ?? ????????? ????????? ???
??????? ??. ?? 2 ??????? ????? ????? ?????? ?? ?
?? ???????. ???? ????????? ?? 1 ??????? ??
????????? ??? ????????? ??? ?? ??????? ????. - ??? ?????????? ?? Windows Forms ????????????
????? ??????? ????????, ????? ???? ?? ??????
??????? ? ??????? ?? Windows Explorer.
134??????????
- ????????? ?????????? TextBox ? ????????
????????????? ???????? NumberTextBox, ?????
????????? ????????? ???? ?? ?????. - ????????? Windows Forms ????????????? ????????
HourMinuteBox, ????? ?? ?????? ?? 2 NumericUpDown
?????? ? ????????? ????????? ?? ??? ? ?????? ?
????????? 000 - 2359. - ???????????? Windows Forms ????????????? ????????
"?????", ????? ???????????? ???????, ? ?????
????? ?? ?? ??????????? ???????? ????????? ?? 1
?? 6 (????? ?? ??? ???????????? ??????? ??? ?????
????). ?????????? ?????? ?? ????????? ?????????
??????????? ? ???????? "Value" ?? ???????? ??
???????? ????????.
135??????????
- ? ??????? ?? ?????????? "?????" ????????????
?????? "??????????" ????? ?????? ??????
??????????????. ??? ????? ??? ???????, ????? ? ??
???, ?????? 2 ??????? (????????? ?? ????????
?????????) ? ????? ??????? ??????, ??????? ?
?????? ?? ?????????? ??????. ?????? ???????,
????? ??????? ?????? 50. ???????????? ?????????
???????????? ?? ????????? ?? ??????? ?????? ??
?????????? ??????. - ???????????? ?????? "??????????" ???? Windows
Forms ???????? ? ? ???????? ? Internet Explorer
??????????? ????????? Web-?????????. ??????????
?? ???????? ?????????? ? JavaScript ??? ?????????
?? ????? ?? Web-??????????.
136??????????
- ??? ?????????? ?? Windows Forms ????????????
??????????, ????? ????? ????? ??? ?????? ???????
? ?????? ??????????. ?????? ????????? ? ?????
????????, ???????????? ? ? ??????? ?????. ???
???????? ?? ?????? ????????? ????? ?
????????????, ?? ????? ? ???????, ? ListBox
???????? ???? ???????? ????? ?? ???????????? ????
?????????? Invoke() ?????? ?? ???????.
???????????? ?????????? ?? ???????????? ??
?????????. ???????????? ????????? ????????????
??? ???????? ????? ????? ?? ?????????? ??????