Welcome to FoxLearn
In this video, I'll show you how to format DataGridView as a material design
To practice the demo, you can create a new windows forms application project
Next, Drag DataGridView and Label controls from your Visual Studio toolbox into your form designer
The label will be used as the header for your form
You can also easily change the colors and fonts for the labels
If you're designing a form that the user can resize at run time,
the controls on your form should resize and reposition properly.
To resize controls dynamically with the form,
you can use the Anchor property of Windows Forms controls.
The Anchor property defines an anchor position for the control.
When a control is anchored to a form and the form is resized,
the control maintains the distance between the control and the anchor positions.
Next, Select your DataGridView control,
then click on the Alternating Rows Default property,
and change your background color.
Tabular data is often presented to users in a ledger-like format where alternating rows have different background colors.
This format makes it easier for users to tell which cells are in each row,
especially with wide tables that have many columns.
And don't forget to set your BorderStyle to None and CellBorderStyle to SingleHorizontal
Next, We will change the Background Color and ForeColor for the ColumnHeadersDefault property
You can specify default cell styles for the entire control and for specific columns and rows
Next, Select your DataGridView,
then add a DataSource to your DataGridView control.
I will use Northwind database for practice.
If you don't have the Northwind database,
you can watch the video I uploaded on how to download and install the Northwind database into SQL Server.
You can also easily remove columns that you don't want displayed on your DataGridView
Thank you for watching this video and don't forget to subscribe to my channel