Tài liệu Windows Forms - Pdf 28

Ch
Ch
apter
apter3
3
Programming with Windows Forms
Programming with Windows Forms
Department of Software Engineering
Department of Software Engineering
Faculty of Information Technology
Faculty of Information Technology
Natural Sciences University
Natural Sciences University
Agenda
Agenda
Agenda
Agenda
Introduction Windows Forms
Introduction Windows Forms
How to handle events in Windows Forms
How to handle events in Windows Forms
Adding controls to forms (design-time)
Adding controls to forms (design-time)
Dynamically adding controls to Forms
Dynamically adding controls to Forms
(runtime)
(runtime)
Using Complex Controls

Windows Forms provides classes for
building UIs
building UIs
e.g. custom forms, common controls, standard
e.g. custom forms, common controls, standard
dialogs
dialogs
Visual Studio .NET provides tools for using
Visual Studio .NET provides tools for using
Windows Forms
Windows Forms
templates for common starting places, and a
templates for common starting places, and a
visual designer
visual designer
Windows Forms Application Structure
Windows Forms Application Structure
Windows Forms Application Structure
Windows Forms Application Structure
A Windows Forms application has three pieces
A Windows Forms application has three pieces
the application itself
the application itself
forms in the application
forms in the application
controls on the form
controls on the form
Application
mainForm
MyForm

CommonAppDataPath
CommonAppDataPath
,
,
UserAppDataPath
UserAppDataPath
CommonAppDataRegistry
CommonAppDataRegistry
,
,
UserAppDataRegistry
UserAppDataRegistry
class MyApp {
public static void Main() {
MyForm form = new MyForm();
System.Windows.Forms.Application.Run(form);
}
}
System.Windows.Forms.Form
System.Windows.Forms.Form
System.Windows.Forms.Form
System.Windows.Forms.Form
Instances of the Form class represent
Instances of the Form class represent
windows
windows
provide window-style services, e.g.
provide window-style services, e.g.
properties:
properties:

Various properties influence a form’s appearance
Often, changing a property results in event notification
Often, changing a property results in event notification
Move
Move
(
(
Location
Location
),
),
Resize
Resize
(
(
Size
Size
),
),
FontChanged
FontChanged
(
(
Font
Font
)
)
Property Type Purpose
Text string Text to display (if applicable)
Location Point Upper/left coordinate of form


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status