110,535
社区成员
发帖
与我相关
我的任务
分享
// DataGridView
DataGridView1.ContextMenuStrip = this.ContextMenuStrip1;
// ContextMenuStrip
DataGridView1.Columns[0].ContextMenuStrip = this.ContextMenuStrip2;
// ContextMenuStrip
DataGridView1.Columns[0].HeaderCell.ContextMenuStrip = this.ContextMenuStrip2;
// ContextMenuStrip
DataGridView1.Rows[0].ContextMenuStrip = this.ContextMenuStrip3;
// ContextMenuStrip
DataGridView1[0, 0].ContextMenuStrip = this.ContextMenuStrip4;
private void DataGridView_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
if (DataGridView.selectrows.count==0)
DataGridView.ContextMenuStrip = contextMenuStrip1;
else
DataGridView.ContextMenuStrip = null;
}
}
private void DToolStripMenuItem_Click(object sender, EventArgs e)
{
DataGridView.Rows[0].Cells["name"].Value=ContextMenuStrip 上面的值;
更新数据库的方法,将界面上改的值更新导数据。。。。
}