How to reduce the row height of a DataGridView Control dynamically in windows.




    can any one tell me how to reduce the height of the rows in DataGridView while generating that DataGridView dynamically. This is in with the windows apps.


    One more is , i am not able to change the color of the cell borders in any manner , neither programmitacally nor through the DataGridView properties.


    Pls ASAP.



    Tuesday, October 02, 2007 2:15 PM


  • Sudatin,


    According to your question on DataGridView control, I would like to provide you the suggestions as follows:


    1. Generating DataGridView dynamically issue: Please take a look at the previous post with the answer provided:


    Creating a Dynamic DataGridView by iterating through an DataTable in Windows


    2. DataGridView row height issue: Please take a look at the article below:


    How to: Use the Row Template to Customize Rows in the Windows Forms DataGridView Control


    The DataGridView control uses the row template as a basis for all rows that it adds to the control either through data binding or when you call the System.Windows.Forms.DataGridViewRowCollection.Add method without specifying an existing row to use.


    The row template gives you greater control over the appearance and behavior of rows than the RowsDefaultCellStyle property provides. With the row template, you can set any DataGridViewRow properties, including DefaultCellStyle.


    3. DataGridView cell border color issue: Please take a look at the article below:


    How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control


    With the DataGridView control, you can customize the appearance of the control's border and gridlines to improve the user experience. You can modify the gridline color and the control border style in addition to the border styles for the cells within the control. You can also apply different cell border styles for ordinary cells, row header cells, and column header cells.


    Hope that can help you.

    Friday, October 05, 2007 7:33 AM