(1) WPF - WPF

1. Window Graphics Evolution

Create the user interface:

  • User32: This section provides a familiar Windows look and feel to many elements such as windows, buttons, text boxes, etc.
  • GDI/GDI+: This part provides drawing support for rendering simple shapes, text, and images, but with added complexity (and generally poorer performance).

Different framework tools (such as .NET, MFC) just provide different wrappers for interacting with User32 and GDI/GDI+, and the bottom layer all use the same part of the Windows operating system to work.

DirectX: the new graphics engine

Features: Provides complex texture mapping, special effects (such as translucency), and hardware acceleration functions required for 3D graphics.
DirectX was once primarily a toolkit for game developers, and now WPF applications use DirectX under the hood.

Two, WPF architecture

Please add a picture description

Some important components included in Figure 1-2:

  • PresentationFramework.dll contains WPF top-level types, including those that represent windows, panels, and other types of controls. It also implements high-level programming abstractions such as styles. Most of the classes that developers use directly come from this assembly.

  • PresentationCore.dll contains basic types, such as UIElement class and Visual class, all shape classes and control classes inherit from these two classes. Use this layer if you don't need the full features of the Window and Control Abstraction Layer and still take advantage of WOF's rendering engine.

  • WindowBase.dll contains more essential elements that have the potential to be reused outside of WPF, such as the DispatcherObject class and the DependencyObject class, which introduce dependency properties.

  • milcore.dll is the heart of the WPF rendering system and the basis for the Media Integration Layer (MIL). Its compositing engine converts visual elements into the triangles and textures that Direct3D expects. Although milcore.dll is considered part of WPF, it is also one of the core system components of Windows Vista and Windows 7. In fact, the Desktop Window Manager (DWM) uses milcore.dll to render the desktop.

  • WindowCodecs.dll is a set of low-level APIs that provide graphics support (such as processing, displaying, and scaling bitmap and IPEG images).

  • Direct3D is a low-level API by which all graphics in a WPF application are rendered.

  • User32 is used to determine which programs actually occupy the portion of the desktop. So it's still included in WPF, but is no longer responsible for rendering common controls.

3. Class Hierarchy

Please add a picture description

1. System.Threading.DispatcherObject class
Single-Thread Affinity (STA) model, the entire user interface is owned by a single thread. It is not safe to interact with user interface elements from another thread. To facilitate using this model, each WPF application is managed by a dispatcher that coordinates messages (keyboard input, mouse movement, or frame processing such as layout). By inheriting from the DispatcherObject class, each element in the user interface can check that code is running on the correct thread, and can marshal code for the user interface thread by accessing the dispatcher.

2. System.Windows.DependencyObject class
In WPF, mainly interact with elements on the screen through properties. During the early design phase, the designers of WPF decided to create a more powerful property model. The model supports features such as change notifications, inheritance of default values, and reduced attribute storage. The end result is the dependency property attribute.

3.System.Windows.Media.Visual class
Each element displayed in the WPF window is essentially a Visual object. Think of the Visual class as a drawing object, which encapsulates drawing instructions, additional details of how drawing is performed (such as clipping, transparency, and transform settings), and basic functionality (such as hit testing). The Visual class also provides a link between the managed WPF library and the milcore.dll assembly that renders the desktop. Any class inherited from Viusal can be displayed on the window. If you prefer to use lightweight API to create user interface, but do not want to use the advanced framework features of WPF.

4.System.Windows.UIElement class
UIElement class adds support for WPF essential features, such as layout, input, focus and events.

5.System.Windows.FrameworkElement class
The FramworkElement class is the last stop in the WPF core inheritance tree. This class implements some of the members that are all defined by the UIElement class. For example, the UIElement class sets the foundation for the WPF layout system, but the FrameworkElement class provides important properties to support it (such as the HorizontalAlignment and Margin properties). The UIElement class also adds support for core features such as data binding, animation, and styling.

6.System.Windows.Shapes.Shape class
Basic shape classes (such as Rectangle class, Polygon class, Ellipse class, Line class and Path class) are inherited from this class. You can use these shape classes in conjunction with more traditional Windows widgets such as buttons and text boxes.

7.System.Windows.COntorls.Control Class
Control (control) is an element that can interact with the user. Controls obviously include the TextBox class, Botton class, and ListBox class, among others. The Control class provides additional properties for setting the font and foreground and background colors.

8.System.Windows.Controls.ContentControl class
ContenControl class is the base class of all controls with a single content, including simple labels and even all the contents of the window. The most impressive part of this model is that a single content in a control can be anything from a plain string to a layout panel with other combinations of shapes and controls.

9.System.Windows.Controls.ItemsControl class
ItemsControl class is the base class for all controls that display a collection of options, such as ListBox and TreeView controls. List controls are very flexible. For example, using the built-in features of the ItemsControl class, you can transform a simple ListBox control into a list of radio buttons, a list of check box controls, a tiled image, or a combination of entirely different elements of your choice. Actually. Menus, toolbars, and status bars in WPF are all specific lists, and the classes that implement them all inherit from the ItemsControl class.

10. System.Windows.Controls.Panel Class
The Panel class is the base class of all layout containers. A layout container is an element that can contain one or more sub-elements and arrange sub-elements according to specific rules.

Guess you like

Origin blog.csdn.net/chen1083376511/article/details/131353656