KHO THƯ VIỆN 🔎

Thinking in C# phần 9

➤  Gửi thông báo lỗi    ⚠️ Báo cáo tài liệu vi phạm

Loại tài liệu:     PDF
Số trang:         130 Trang
Tài liệu:           ✅  ĐÃ ĐƯỢC PHÊ DUYỆT
 













Nội dung chi tiết: Thinking in C# phần 9

Thinking in C# phần 9

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Thinking in C# phần 9 endering capabilities of Windows XP. Windows Forms interfaces are based on the concept of Controls that, among other things, know how to draw themselv

es. 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. Thinking in C# phần 9

GDI+ provides a range of drawing, coordinate, and measurement tools ranging from simple line-drawing to complex gradient fills. The advantage of this

Thinking in C# phần 9

is that virtually any kind of interface can be created using GDI+ (3D interfaces require DirectX, which will be discussed later). Tile disadvantage is

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Thinking in C# phần 9 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 discussi Thinking in C# phần 9

on begins, but the power of MVC can become more attractive as one contemplates building UIs with innovative display or input characteristics The sampl

Thinking in C# phần 9

e code 111 this chapter does not separate domain logic from display and should not be used as a starting place for your designs.Your canvas: the Graph

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Thinking in C# phần 9 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 co

ntrol TypicaUly, you will create a new class inheriting from Panel, and define your own properties to control your object's appearance You'll sometime Thinking in C# phần 9

s hear people referring to this process as developing an owner-draw control.659The canvas on which you draw is an instance of the Graphics class. Tins

Thinking in C# phần 9

class encapsulates the GDI+ drawing surface for your Control. You do not have to worn7 about other windows (or even other Controls), screen location,

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Thinking in C# phần 9 ows Forms interface.Every instance of Graphics that you use consumes a low-level operating system resource (a Win32 handle). Tins leads to two restric

tions:♦You must always call Dispose() on a Graphics object when you are done with it; you can either do this in a try...finally block or with the usin Thinking in C# phần 9

g keyword.♦You must not maintain a reference to a Graphics() object outside of the event handler which obtained It, as the imderlying handle is not gu

Thinking in C# phần 9

aranteed to be valid over time.There are several ways to obtain a reference to a Graphics object. The most direct is to call Control.CreateGraphics(),

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Thinking in C# phần 9 d, it gets a reference to a Graphics object for the target and tills the target’s client area with red.//:cl5:GraphicsHandle.es//Accessing the drawing

surface of a controlusing System;using System.Drawing;using system.Windows.Forms;class GraphicsHandle : Form {Button target;GraphicsHandle(){target Thinking in C# phần 9

new Button();target.Location - new Point(10, 10);Controls.Add{target);Button controller - new ButtonO;controller.Location new Point(10, 60);controlle

Thinking in C# phần 9

r.Text - "Clear target Graphics”;controller.Width 150;controller.Click -- new EventHandler(OnClick);660Thinking inwwwMindView.netControls.Add(control

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

15: GDI+ OverviewWhile Windows Forms provides a great basis for the large majority of user interfaces, the .NET Framework allows access to the full re

Gọi ngay
Chat zalo
Facebook