Return to Snippet

Revision: 41135
at February 12, 2011 14:32 by Sootah


Initial Code
public double dataGridTitleSizeRatio = 3.35;        //3.563492063492063
        public double dataGridSearchTermSizeRatio = 5.98;   //5.986666666666667
        public double dataGridURLSizeRatio = 2.27;          //2.273417721518987

        private void dataGrid_Resize(object sender, EventArgs e)
        {
            dataGrid.Columns[0].Width = Convert.ToInt32((Convert.ToDouble(dataGrid.Width) / dataGridTitleSizeRatio));
            dataGrid.Columns[2].Width = Convert.ToInt32((Convert.ToDouble(dataGrid.Width) / dataGridSearchTermSizeRatio));
            dataGrid.Columns[3].Width = Convert.ToInt32((Convert.ToDouble(dataGrid.Width) / dataGridURLSizeRatio));
        }

Initial URL

                                

Initial Description

                                

Initial Title
dataGrid_Resize - Automatically resize columns as DataGridView is resized

Initial Tags

                                

Initial Language
C#