// Experiment with DataGridView // sestoft@dina.kvl.dk * 2005-05-03 using System; using System.Windows.Forms; class MyTest { public static void Main(String[] args) { Form form = new Form(); form.Text = "SuperCalc 2005"; DataGridView dgv = new DataGridView(); dgv.ShowEditingIcon = false; // Show current cell's reference in top lefthand corner: dgv.CellEnter += delegate(Object sender, DataGridViewCellEventArgs arg) { int row = arg.RowIndex, col = arg.ColumnIndex; dgv.TopLeftHeaderCell.Value = ColumnName(col) + (row+1); }; dgv.ColumnCount = 70; dgv.RowCount = 40; dgv.AllowUserToAddRows = false; // Put labels on columns and rows: for (int col=0; col= 26) { name = (char)('A' + col % 26) + name; col = col / 26 - 1; } return (char)('A' + col) + name; } }