using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace windowDemo
{
public partial class DateGridView镶嵌查询 : Form
{
public DateGridView镶嵌查询()
{
InitializeComponent();
}
bool isEnter = false;
/// <summary>
/// 在ProcessCmdKey 捕捉“确定”事件,并更改状态
/// </summary>
/// <param name="msg"></param>
/// <param name="keyData"></param>
/// <returns></returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter)
isEnter = true;
return base.ProcessCmdKey(ref msg, keyData);
}
private void dataGridView1_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
{
if (isEnter)
{
dataGridView1.Rows[e.RowIndex].Cells[1].Value= "测试商品名称";
dataGridView1.Rows[e.RowIndex].Cells[2].Value="测试单价";
dataGridView1.Rows[e.RowIndex].Cells[3].Value = "测试数量";
}
}
}
}