📜  WPF 和 WinForms 的区别

📅  最后修改于: 2021-09-13 03:01:12             🧑  作者: Mango

WPF(Windows Presentation Foundation): WPF,顾名思义,是一个用于开发Windows或桌面客户端应用程序的UI框架。它是与 .NET 框架一起使用的 GUI 框架的最新方法。引入它是为了开发在 Windows 操作系统上运行的 Windows 客户端应用程序,以及下一代 Windows 窗体。它具有开发、运行、执行、管理和处理 Windows 客户端应用程序所需的所有功能。

它通常提供用于组合或集成 UI、2D 和 3D 图形、数字媒体和文档的整体方法。它负责在 Windows 7 及更高版本的操作系统中开发、显示和操作 UI、文档、图像等。它是当前用于开发 Windows 应用程序的平台。

WinForms(Windows 窗体应用程序): WinForms,顾名思义,基本上是引入到 .NET 框架中的一种基于 GUI 的方法。在 WPF 和 Silverlight 之前,它是用于构建 GUI 的 .NET 的主要 API。除了运行时和操作系统之外,它不需要任何类型的支持来开发独立应用程序。

人们可以开发在连接到 Internet 时易于部署、更新、管理和脱机工作的应用程序。 WinForms 的开发非常简单,因为它仅基于 UI 控件在画布上的拖放放置。它是用于开发桌面应用程序的旧平台。

WPF 和 WinForms 的区别:

WPF

WinForms  

It is based on DirectX with XAML support.   It provides access to the native windows library of common controls.  
It uses markup language for designing UI allowing the design of complex user interfaces.   It does not use a markup language for design. In fact, it uses event-driven controls for the design. 
It can render fast as compared to WinForms, complexity, and support.   It renders slow as compared to WPF.  
It can be used to develop and design both windows applications and web applications.   It can only be used to develop and design windows applications.  
It has unlimited UI customization and controls can be customized easily as it is totally written from scratch.  In this, controls are limited and difficult to customize.  
It is easier to separate UO from back-end logic.   It is tough to separate UI from back-end logic. 
It allows you to handle large data sets because of its in-built feature “user interface virtualization”. It does not have a “user interface virtualization” feature.  
It takes up more RAM than WinForms.   It takes a smaller memory footprint. 
It is considered good when the application requires many media types, create a skinned UI, bind to XML, develop a desktop application having a web-like navigation style.   It is considered good if you want to develop an application without much added modern functionality, more online resources.  
It offers effective and fully supported data binding as compared to WinForms.   It offers data binding but in a limited way. Therefore, it’s less effective as compared to WPF. 
It also offers rich, interactive, animated, hardware accelerated, vector 2D and 3D capabilities for developing applications.   It does not offer any rich, Interactive, animated, hardware accelerated, vector 2D and 3D capabilities as compared to WPF.  
It is a little bit tough, time-consuming, and complex to use WPF as compared to WinForms.   It is simple to use WinForms as controls can be used easily, it’s less time-consuming and less tricky as compared to WPF.  
It has an inbuilt story boarding feature and animation model, it has the ability to use business objects in UI declaratively.   It does not provide such features.