Windows Forms

Why Trust Techopedia

What Does Windows Forms Mean?

Windows Forms is a set of managed libraries in .NET Framework designed to develop rich client applications. It is a graphical API to display data and manage user interactions with easier deployment and better security in client applications.


Windows Forms offers an extensive client library providing interface to access native Windows graphical interface elements and graphics from managed code. It is built with event-driven architecture similar to Windows clients and hence, its applications wait for user input for its execution.

Windows Forms is similar to Microsoft Foundation Class (MFC) library in developing client applications. It provides a wrapper consisting of a set of C++ classes for development of Windows applications. However, it does not provide a default application framework like the MFC.

Techopedia Explains Windows Forms

Every control in Windows Forms application is a concrete instance of a class. The layout of a control in the GUI and its behavior are managed using methods and accessors. Windows Forms provides a variety of controls, such as text-boxes, buttons, and web pages along with options to create custom controls. It also contains classes for creating brushes, fonts, icons, and other graphic objects (like line and circle).

Windows Forms Designer is a tool, in Visual Studio.NET, used to insert controls in a form and arrange them as per desired layout, with provision for adding code to handle their events, which implement user interactions. Tabular data that is bound to XML, database, etc. can be displayed using DataGrid View control in the form of rows and cells.

Application settings is another feature of Windows Forms to create, store, and maintain runtime state information in an XML form that can be used to retrieve the user-preferred settings, such as toolbar positions and most-recently used lists. These settings can be reused in a future application.

Some of the best practices for building Windows Forms applications include:

  • Windows Forms classes can be extended, using inheritance, to design an application framework that can provide high level of abstraction and code reusability.
  • Forms should be compact, with controls on it limited to a size that can offer minimum functionality. Additionally, the creation and removal of controls dynamically can reduce the number of static controls.
  • Forms can be broken into chunks packaged in assemblies that can automatically update itself and can be easily managed with minimal effort.
  • Designing the application to be stateless provides scalability and flexibility with ease for debugging and maintenance.
  • Windows Forms applications should be designed based on the level of trust required, the need to request for permissions, and handle security exceptions wherever necessary.
  • Windows Form cannot be passed across application domain boundary since they are not designed to be marshaled across application domains.

Windows presentation Framework (WPF) is the latest technology for rendering user interfaces in Windows GUI applications with features such as 2D/3D support, interactive data visualization, and content readability. It relies on DirectX rather than GDI (Graphic Device Interface) objects for providing a programming model where the user interface is separated from business logic. However, with the ability to interoperate with WPF (wherever required), Windows Forms stands as a good choice for applications that do not require media-rich GUI and other WPF features like data/control templates, typographic, and text rendering features.


Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.