Getting Started with Windows Forms Rating Control (Rating)
10 Oct 20223 minutes to read
Assembly deployment
Refer to the Control dependencies section to get the list of assemblies or details of NuGet package that needs to be added as a reference to use the control in any application.
Click NuGet Packages to learn how to install nuget packages in a Windows Forms application.
Adding Rating control via designer
-
Create a new Windows Forms project in Visual Studio to display the Rating Control with different shapes.
-
The Rating control can be added to an application by dragging it from the toolbox to a designer view. The following dependent assemblies will be added automatically:
- Syncfusion.Grid.Base
- Syncfusion.Grid.Windows
- Syncfusion.Shared.Base
- Syncfusion.Shared.Windows
- Syncfusion.Tools.Base
- Syncfusion.Tools.Windows
Adding Rating control via code
To add the control manually in C#, follow the given steps:
-
Create a C# or VB application using Visual Studio.
-
Add the following assembly references to the project:
- Syncfusion.Grid.Base
- Syncfusion.Grid.Windows
- Syncfusion.Shared.Base
- Syncfusion.Shared.Windows
- Syncfusion.Tools.Base
- Syncfusion.Tools.Windows
-
Include the required namespaces.
using Syncfusion.Windows.Forms.Tools;
Imports Syncfusion.Windows.Forms.Tools
-
Create an instance of the Rating control, and add it to the form.
RatingControl ratingControl1 = new RatingControl (); this.Controls.Add(ratingControl1);
Dim ratingControl1 As RatingControl = New RatingControl Me.Controls.Add(ratingControl1)
-
Set the rating value using the Value property.
ratingControl2.Value = 3;
ratingControl2.Value = 3
Built-in shapes for rating
The following six predefined shapes are available in the Rating Control for customization:
- Star
- Circle
- Triangle
- Heart
- Diamond
- Kite
You can customize the shapes of the RatingControl using the Shape property.
//Setting shape
this.ratingControl1.Shape = Syncfusion.Windows.Forms.Tools.Shapes.Heart;
‘Setting shape
Me.ratingControl1.Shape = Syncfusion.Windows.Forms.Tools.Shapes.Heart