1、dataGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
/DGridMouseDown/#region /DGridMouseDown/
/**//// <summary>
/// dataGrid1 MouseDown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dataGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//HitTest 方法返回包含所单击区域的行和列的 DataGrid.HitTestInfo 对象
DataGrid myGrid = (DataGrid) sender;
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
switch (hti.Type)
{
case System.Windows.Forms.DataGrid.HitTestType.Cell :
if (e.Clicks==2)
{
//记忆当前行号
currentERowIndex=hti.Row;
GetSomeFileName(myGrid,hti.Row);
//myGrid.Select(hti.Row);
}
break;
case System.Windows.Forms.DataGrid.HitTestType.RowHeader :
//记忆当前行号
currentERowIndex=hti.Row;
GetSomeFileName(myGrid,hti.Row);
break;
}
}
#endregion
/**//// <summary>
/// dataGrid1 MouseDown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dataGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//HitTest 方法返回包含所单击区域的行和列的 DataGrid.HitTestInfo 对象
DataGrid myGrid = (DataGrid) sender;
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
switch (hti.Type)
{
case System.Windows.Forms.DataGrid.HitTestType.Cell :
if (e.Clicks==2)
{
//记忆当前行号
currentERowIndex=hti.Row;
GetSomeFileName(myGrid,hti.Row);
//myGrid.Select(hti.Row);
}
break;
case System.Windows.Forms.DataGrid.HitTestType.RowHeader :
//记忆当前行号
currentERowIndex=hti.Row;
GetSomeFileName(myGrid,hti.Row);
break;
}
}
#endregion
2、
/*响应MouseDown/#region /*响应MouseDown/
/**//// <summary>
/// 根据DataGrid1 MouseDown,填充下拉列表中的显示数据
/// </summary>
/// <param name="myGrid">dataGrid1</param>
/// <param name="index">选择的行号</param>
private void GetSomeFileName(DataGrid myGrid,int index)
{
try
{
acb_YEAR.Text=myGrid[index,1].ToString();
acb_AREA.Text=myGrid[index,2].ToString();
//提取文件路径
currentEFileName=myGrid[index,8].ToString();
//路径解密
GetELastPath();
}
catch (Exception err)
{
MessageBox.Show(this,err.Message.ToString(),"信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
/**//// <summary>
/// 根据DataGrid1 MouseDown,填充下拉列表中的显示数据
/// </summary>
/// <param name="myGrid">dataGrid1</param>
/// <param name="index">选择的行号</param>
private void GetSomeFileName(DataGrid myGrid,int index)
{
try
{
acb_YEAR.Text=myGrid[index,1].ToString();
acb_AREA.Text=myGrid[index,2].ToString();
//提取文件路径
currentEFileName=myGrid[index,8].ToString();
//路径解密
GetELastPath();
}
catch (Exception err)
{
MessageBox.Show(this,err.Message.ToString(),"信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion