There are always friends who ask: "What is the difference between WinForm and WPF?"
Thinking about this question seems to be a simple answer, but it has never been systematically analyzed. Today, I took the time to write an article record summary that only represents my personal opinion.

WinForms
As the name suggests, it is basically a GUI-based approach to introducing the. NET framework. Before WPF and Silverlight, it was the main API for. NET for building GUIs. It does not require any type of support other than the runtime and operating system to develop stand-alone applications. Applications can be developed that are easy to deploy, update, manage, and work offline while connecting to the Internet. WinForms is very simple to develop because it is simply based on drag-and-drop placement of UI controls on the canvas. It is the old platform for developing desktop applications.
WPF(Windows Presentation Foundation)
WPF, as the name suggests, is a UI framework for developing Windows or desktop client applications. It is the latest approach to GUI frameworks used with. NET frameworks. It was introduced to develop Windows client applications that run on the Windows operating system, as well as the next generation of Windows Forms. It has all the functions needed to develop, run, execute, manage and process Windows client applications.
Different difficulty to get started
Windows form is relatively less difficult than wpf, because wpf requires you to learn the syntax of xaml and mvvm, while most winforms only need to drag and drag controls to quickly get started on a project.
Different rendering mechanisms
WinForm GDI+ rendering,WPF DirectX rendering
GDI + :编写图形程序时需要使用 GDI(GraphicsDeviceInterface,图形设备接口),从程序设计的角度看,GDI 包括两部分:一部分是 GDI 对象,另一部分是 GDI 函数。GDI 对象定义了 GDI 函数使用的工具和环境变量,而 GDI 函数使用 GDI 对象绘制各种图形,在 C#中,进行图形程序编写时用到的是 GDI+(GraphiceDeviceInterfacePlus 图形设备接口)版本,GDI+是 GDI 的进一步扩展,它使我们编程更加方便。
简单理解就是2D绘图
DirectX(Direct eXtension,缩写:DX)是由微软公司创建的一系列专为多媒体以及游戏开发的应用程序接口。旗下包含 Direct3D、Direct2D、DirectCompute 等等多个不同用途的子部分,因为这一系列 API 皆以 Direct 字样开头,所以 DirectX(只要把 X 字母替换为任何一个特定 API 的名字)就成为这一巨大的 API 系列的统称。
简单理解就是既能2D,也能3D绘图
简单理解,WPF理论上可以写更牛X的界面。渲染速度更快,复杂度更高
Different core mechanisms
Winform event driven,WPF data driven
数据驱动:数据第一,控件第二。数据的变化带动 UI,
便于前后端解耦。
事件驱动:通过事件绑定方式,实现控件各项事件的触发来调用业务层逻辑使程序有序运行,
极容易造成前后端高耦合。
Control existence form
Complex GUI applications in Windows GDI or WinForm development will use a large number of controls, such as Grid. Each control or Grid cell is a small window and uses a Window handle. Although the control manufacturer provides many optimization methods, it will still encounter Out of Memory or "Error Create Window handle", causing the program to exit.
WPF has completely changed the display mode of controls. Controls no longer use windows and will not occupy Window handles. In theory, if a WPF has only one main window, the WPF will only use one Window handle (if the hidden windows used for Dispatcher are ignored). Therefore, WPF GUI programs will not have enough Window handles.
WinForm VS WPF
| distinctive points | WinForms | WPF |
|---|---|---|
| renderings | GDI+ | DirectX |
| rendering speed | slow | fast |
| difficulty of getting started | ordinary | more difficult |
| driving mechanism | event-driven | data-driven |
| Whether the front and rear ends are separated | Not easily separated | easier to separate |
| adaptive | more difficult | easy |
| Provides vector 2D and 3D functions | no | is |
| requires memory | less | more |
| Support interface virtualization to facilitate processing of large data sets. | not support | support |
| Controls exist in the form of windows | is | no |