TAILIEUCHUNG - Thinking in C# phần 9

Các hình thức cửa sổ giao diện dựa trên khái niệm của điều khiển, trong số những thứ khác, biết làm thế nào để vẽ chính mình. Nếu giao diện của bạn đòi hỏi phải có bản vẽ đó là vượt ra ngoài khả năng của các điều khiển theo ý của bạn, bạn sẽ cần phải chuyển sang NET. GDI + không gian tên. Số lượng chi tiết liên quan đến xử lý redraws và đầu vào có nghĩa là | 15 GDI Overview While Windows Forms provides a great basis for the large majority of user interfaces the .NET Framework allows access to the full rendering capabilities of Windows XP. Windows Forms interfaces are based on the concept of Controls that among other things know how to draw themselves. If your interface requires drawing that s beyond the capabilities of the Controls at your disposal you ll need to turn to .NET s GDI namespaces. GDI provides a range of drawing coordinate and measurement tools ranging from simple line-drawing to complex gradient fills. The advantage of this is that virtually any kind of interface can be created using GDI 3D interfaces require DirectX which will be discussed later . The disadvantage is that GDI is stateless and you must write code capable of re-rendering the entire GDI interface at any time. Most GDI work will also involve writing custom input code. The amount of detail involved in handling redraws and input means that you must pay even more attention to separating domain logic from your interface code. It s difficult for the FEC architecture to handle the complexity of a GDI interface. PAC should still be where the discussion begins but the power of MVC can become more attractive as one contemplates building UIs with innovative display or input characteristics. The sample code in this chapter does not separate domain logic from display and should not be used as a starting place for your designs. Your canvas the Graphics Class The Control class is at the center of Windows Forms programming you place a Control you set certain attributes of it you associate it with business logic. All of these hold true in GDI programs except that you will be responsible for drawing everything within the client area of your control. Typicallly you will create a new class inheriting from Panel and define your own properties to control your object s appearance. You ll sometimes hear people referring to this process as developing an owner-draw

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.