Dynamic Data Grid for Windows Forms Sizing Routine


This article and the attached source code project is called GridLayoutHelper and it allow you to size a Windows Forms DataGrid much like you can an ASP.NET DataGrid.

The Windows Forms DataGrid provides no sizing features,unlike the awesome capabilities of the ASP.NET DataGrid.This example shows a very easy to plug in class I call GridLayoutHelper. With merely one line of code you can attach the GridLayoutHelper to a WinForms DataGrid and dynamically size the columns based on Percentages like the ASP.NET DataGrid.The default sizing routine will size all columns evenly, you can even provide minimum column widths.The nicest thing about GridLayoutHelper is that the columns always take up the total client space of the DataGrid making for a much more professional look.

There are two attachments, a snapshot of what it looks like and a tiny file that contains the GridLayoutHelper with a Windows Forms sample.