Home >Common Problem >The difference between wpf and winform
WinForm is a name for Windows Form in ·Net development platform.
WPF (Windows Presentation Foundation) is a Windows-based user interface framework launched by Microsoft and is part of the .NET Framework 3.0. It provides a unified programming model, language and framework, truly separating the work of interface designers and developers; at the same time, it provides a new multimedia interactive user graphical interface. It is a product launched by Microsoft to replace winform. It can separate the work of interface designers and developers and provide a multimedia interactive user graphical interface. The three core assembly sets are presentationcore, presentationFramework, and windowsBase
The biggest difference between WPF and winform is that the bottom layer of WPF uses DirectX, and the bottom layer of winform uses GDI, so WPF’s graphical interface is superior
(recommended learning:PHP video tutorial)
GDI (Graphics Device Interface) graphics device interface, its main task is to be responsible for the exchange and processing of information between drawing programs, and the graphics output of all windows programs
DirectX (Direct Extension) multimedia programming interface, which enhances 3D graphics and sound effects, consists of many APIs. It can be divided into four parts according to its nature: display part, sound part, input part and network part
When developing WinForm programs, one of the most troublesome problems is that the worker thread modifies the properties of the control, causing the program to crash. , and this illegal operation does not fail every time. The WinForm control provides the InvokeRequired property to determine whether the current thread is the control creation thread. The problem is that when the control tree is very deep, this property will be slower.
When WPF started to be designed, the issue of multi-threading was taken into consideration. Most WPF classes inherit from DispatcherObject. DispatcherObject is actually a simple encapsulation of Dispatcher. Dispatcher provides a method (CheckAccess) similar to InvokeRequired. This method just compares the thread IDs, so it will be fast. In addition, Dispatcher provides priority queue, asynchronous call, Timer and other functions, simplifying the development of multi-threaded GUI programs.
Composition of the control
If you want to implement a drop-down menu with a Checkbox in WinForm, you will have to process complex Window messages. Through the Content Model and Layout system of WPF controls, WPF controls can include any type of control, even .Net CLR objects. Many modern control manufacturers also provide Composition controls, and the implementation methods are similar to WPF's Content model. The WPF development team should have borrowed many of Infragistics' ideas. With this foundation, developing new WPF controls is easier.
XAML
Personally, I think XAML should be a more epoch-making thing in WPF. Through XAML, we can describe complex Object Graph in text. This idea already exists in VB, but XAML is simplified so that tools can be used to generate XAML. Through mechanisms such as Command and Routing Event, interface designers and programmers have relatively clear boundaries.
For more PHP related technical articles, please visit the PHP Graphic Tutorial column to learn!
The above is the detailed content of The difference between wpf and winform. For more information, please follow other related articles on the PHP Chinese website!