Windows Forms, popularly known as WinForms, is a UI (User Interface) framework used to create rich desktop client apps for Windows. It includes a drag-drop visual designer that lets you easily create a Windows Forms application.
In this blog, we will see how to add .NET WinForms controls to your Windows Forms application, including controls from NuGet and GrapeCity ComponentOne WinForms edition.
Creating a Windows Forms Application
- Open Visual Studio. The version of Visual Studio required will depend on the .NET version you want to target. For this blog, we will be targeting .NET Framework 4.8 and using Visual Studio 2019.
- Create a new “Windows Forms App (.NET Framework)” project, or if you are targeting .NET Core or .NET 5/6, then you will need to choose the “Windows Forms App” template.
Adding Windows Forms Controls
After opening your Windows Forms App in Visual Studio, you can open the Designer for a Form by either double-clicking on it or choosing the View Designer option from its context menu. In Windows Forms, a form is a visual surface where you place controls, and the designer lets you easily add, arrange, and write code for the event of controls on a form.
You can build your entire UI by adding and arranging basic controls such as Buttons, Textbox, Panel, DataGridView, etc., on a Form. For more information on Microsoft’s Window Forms Controls, you can visit MSDN.
In Visual Studio, the Toolbox window display controls that you can add to your project. Choose View > Toolbox from the menu bar or press Ctrl+Alt+X to open Toolbox. Now you can add controls to the Form’s surface by dragging them from the Toolbox and dropping them onto the Form.
Adding Windows Forms Controls from NuGet
If you create a simple application that displays some data on a Form, standard controls should fulfill your requirements. Although in most cases, you will require advanced UI controls that provide additional functionalities. NuGet is the best place to find UI libraries for your project.
To install a NuGet package in your Visual Studio project, select Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution. This will open the NuGet package search window where you can search for different UI libraries by terms like “WinForms input” or “WinForms ribbon.” You can then choose a library to install in your project from the search results.
Once you have the library installed, you will be able to see its controls in the toolbox, and you can start using them in Windows Forms Designer as you would use a standard control.
This way, you can add many third-party UI libraries to the WinForms application. The below section provides a few details about one of the best third-party WinForms UI libraries – ComponentOne from GrapeCity.
ComponentOne WinForms Controls
One of the best third-party UI libraries that provides Winforms controls with advanced extended functionality is ComponentOne WinForms Edition. Grapecity’s ComponentOne product line provides developers with a complete toolkit of UI controls. It offers over 120 advanced WinForms UI controls and components that help developers build intuitive, modern Windows Forms applications in less time.
It includes several high-performing, flexible controls, including one of the industry’s best WinForms data grid control - FlexGrid, various WinForms input controls for any data entry scenario, fluent ribbon-style toolbar based on UI concepts from Microsoft Office 365, and many more.
You can easily add these controls from NuGet as we explained above, start searching with the keyword C1.Win.* and you will find all the C1 Winforms packages.
To explore more about ComponentOne controls, you can go through the following links:
ComponentOne also has added .NET 6 controls to the WinForms Edition and moving forward in 2022, and you will see many more features and enhancements for .NET 6 and Visual Studio 2022. You can check out the 2022 Roadmap for more details.