在窗体中添加DataGridView控件和ConTextMenuStrip1控件,修改DataGridView属性,将contextMenuStrip控件绑定dataGridView控件
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //选中整行可在属性中修改
datagridview.AutoGenerateColumns = false;//不让datagridview自动生成列,可在属性中修改
datagridview.AllowUserToAddRows