Đang chuẩn bị liên kết để tải về tài liệu:
Manning Windows Forms Programming (phần 2)

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'manning windows forms programming (phần 2)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Alternatively an alias for a specific type can be created. For example a shortcut for the Application class can be defined with using MyAppAlias System.Windows.Forms.Application This would permit the following line in your code MyAppAlias.Run new MyForm Typically the using directive simply indicates the namespaces employed by the program and this is how we use this directive in our program. For example rather than the fully qualified names System.Windows.Forms.Button and Sys-tem.Windows.Forms.PictureBox we simply use the Button and PictureBox names directly. It is worth noting that there is also a Button class in the System.Web.UI.Web-Controls namespace. The compiler uses the correct System.Windows. Forms.But-ton class because of the using keyword and because the System.Web namespace is not referenced by our program. When we look at Visual Studio .NET in chapter 2 you will see that Visual Studio tends to use the fully qualified names everywhere. This is a good practice for a tool that generates code to guarantee that any potential for ambiguity is avoided. 1.2.2 Fields and properties Let s go back to our use of the Button and PictureBox classes. The top of our class now defines two member variables or fields in C to represent the button and the picture box on our form. Here Button and PictureBox are classes in the Windows Forms namespace that are used to create a button and picture box control on a Form. We will tend to use the terms class and control interchangeably for user interface objects in this book.3 public class MyForm Form private Button btnLoad private PictureBox pboxPhoto Fields like all types in C must be initialized before they are used. This initialization occurs in the constructor for the MyForm class. public MyForm Create and configure the Button btnLoad new Button btnLoad.Text Load btnLoad.Left 10 btnLoad.Top 10 3 Or more formally we will use the term control to refer to an instance of any class derived from the Control class in the .