Windows Forms
Số trang: 0
Loại file: pdf
Dung lượng: 165.74 KB
Lượt xem: 16
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Windows Forms Overview about describe the structure of a Windows Forms application (application entry point, forms, components and controls); Introduce deployment over networks. It provides about Visual Studio, Application Structure, Form border; Form properties.
Nội dung trích xuất từ tài liệu:
Windows FormsWindows FormsOverview• Describe the structure of a Windows Forms application – application entry point – forms – components and controls• Introduce deployment over networks 2Windows Forms• Windows Forms are classes for building UIs – forms, controls, dialogs, etc. – part of the .NET Framework Library – core classes in System.Windows.Forms namespace• Possible uses include: – stand-alone Windows applications – web services front-ends – intranet “smart clients” 3Visual Studio• Visual Studio .NET provides development environment – starter templates, drag-and-drop editing, property grid, etc. 4Application Structure• Windows Forms application has three main pieces – the application itself – forms in the application – controls and components on the forms Label Application myForm Hello, World! mainForm label1 button1 Button OK 5Application• Application class represents the application itself – Run method processes UI events delivered by Windows – provides access to application environment ExecutablePath, CommonAppDataPath, UserAppDataPath, etc. – no instances, all members are static class MyApp { public static void Main() { MyForm form = new MyForm();start application Application.Run(form); } } 6 Form • Form class represents window, provides appropriate services – properties: Size, Location, Controls, ShowInTaskbar – methods: Show, Close, SetDesktopLocation – events: Load, Click, Closing • Common to derive from Form to create custom formdefine custom form class MyForm : Form { public MyForm() { this.ShowInTaskbar = false; set properties this.Location = new Point(10, 10); this.Size = new Size(100, 100); } } 7Form border• Forms can look like windows, dialogs, or tools – controlled using FormBorderStyle property – set ShowInTaskbar property to false for tool windows – window border styles show the icon from the Icon property 8 Form properties • Form has many properties – used to customize appearance and behavior public class Form : ContainerControl { public IButtonControl AcceptButton { get; set; } public IButtonControl CancelButton { get; set; } public bool HelpButton { get; set; } public Icon Icon { get; set; } public String Text { get; set; } public Size MaximumSize { get; set; }properties public Size MinimumSize { get; set; } public MainMenu Menu { get; set; } public bool ShowInTaskbar { get; set; } public FormBorderStyle FormBorderStyle { get; set; } ... } 9 Form as container • Form manages a list of controls – stored in Controls collection propertyall forms inherit class MyForm : FormControls collection { Button button1 = new Button(); Label label1 = new Label (); public MyForm() { ... this.Controls.Add(button1); add to collection this.Controls.Add(label1 ); } ... } myForm Controls button1 label1 10Form layout• Form determines layout for controls it manages – recalculates as needed, such as when user resizes form – tries to accommodate control preferences for size and location – uses Anchor and ...
Nội dung trích xuất từ tài liệu:
Windows FormsWindows FormsOverview• Describe the structure of a Windows Forms application – application entry point – forms – components and controls• Introduce deployment over networks 2Windows Forms• Windows Forms are classes for building UIs – forms, controls, dialogs, etc. – part of the .NET Framework Library – core classes in System.Windows.Forms namespace• Possible uses include: – stand-alone Windows applications – web services front-ends – intranet “smart clients” 3Visual Studio• Visual Studio .NET provides development environment – starter templates, drag-and-drop editing, property grid, etc. 4Application Structure• Windows Forms application has three main pieces – the application itself – forms in the application – controls and components on the forms Label Application myForm Hello, World! mainForm label1 button1 Button OK 5Application• Application class represents the application itself – Run method processes UI events delivered by Windows – provides access to application environment ExecutablePath, CommonAppDataPath, UserAppDataPath, etc. – no instances, all members are static class MyApp { public static void Main() { MyForm form = new MyForm();start application Application.Run(form); } } 6 Form • Form class represents window, provides appropriate services – properties: Size, Location, Controls, ShowInTaskbar – methods: Show, Close, SetDesktopLocation – events: Load, Click, Closing • Common to derive from Form to create custom formdefine custom form class MyForm : Form { public MyForm() { this.ShowInTaskbar = false; set properties this.Location = new Point(10, 10); this.Size = new Size(100, 100); } } 7Form border• Forms can look like windows, dialogs, or tools – controlled using FormBorderStyle property – set ShowInTaskbar property to false for tool windows – window border styles show the icon from the Icon property 8 Form properties • Form has many properties – used to customize appearance and behavior public class Form : ContainerControl { public IButtonControl AcceptButton { get; set; } public IButtonControl CancelButton { get; set; } public bool HelpButton { get; set; } public Icon Icon { get; set; } public String Text { get; set; } public Size MaximumSize { get; set; }properties public Size MinimumSize { get; set; } public MainMenu Menu { get; set; } public bool ShowInTaskbar { get; set; } public FormBorderStyle FormBorderStyle { get; set; } ... } 9 Form as container • Form manages a list of controls – stored in Controls collection propertyall forms inherit class MyForm : FormControls collection { Button button1 = new Button(); Label label1 = new Label (); public MyForm() { ... this.Controls.Add(button1); add to collection this.Controls.Add(label1 ); } ... } myForm Controls button1 label1 10Form layout• Form determines layout for controls it manages – recalculates as needed, such as when user resizes form – tries to accommodate control preferences for size and location – uses Anchor and ...
Tìm kiếm theo từ khóa liên quan:
Windows Forms structure of a Windows Forms Windows Forms application Visual Studio Application Structure Form propertiesGợi ý tài liệu liên quan:
-
Lập trình .net 4.0 và visual studio 2010 part 63
7 trang 128 0 0 -
Hướng dẫn thực hành lập trình C trên Visual Studio
9 trang 125 0 0 -
80 trang 39 1 0
-
Ebook Microsoft Visual Basic 2013 Step by Step - Michael Halvorson
700 trang 27 0 0 -
Lập trình .net 4.0 và visual studio 2010 part 11
6 trang 23 0 0 -
Lập trình .net 4.0 và visual studio 2010 part 60
9 trang 21 0 0 -
Lập trình .net 4.0 và visual studio 2010 part 3
10 trang 21 0 0 -
Ebook Windows Forms Programming with C# - Erik Brown
755 trang 19 0 0 -
Dạng bài tập về Micosoft.NET- P8
5 trang 19 0 0 -
Lập trình .net 4.0 và visual studio 2010 part 50
7 trang 18 0 0