private void grdMei_MouseEnterCell(object sender, RowColEventArgs e)
{
int row = grdMei.MouseRow;
int col = grdMei.MouseCol;
int cellCount = 0;
if (row > 0 && col > 0)
{
frmCellInfo frm = new frmCellInfo();
cellInfo = new DataTable();
cellInfo.Columns.Add("info");
cellInfo.Columns.Add("color");
// 初期化処理の場合
if (this.colDT.Columns.Count == 0)
{
cellCount = (int)FGRID.NO_25;
}
else
{
cellCount = this.colDT.Columns.Count / 2 + 2;
}
for (int i = cellCount; i < this.grdMei.Cols.Count; i++)
{
DataRow newRow = cellInfo.NewRow();
string name = this.grdMei.Cols.Caption;
int num = Conv.GetInt(name.Substring(2));
if (this.grdMei.GetData(row, i) == null)
{
newRow["info"] = num.ToString();
newRow["color"] = DBNull.Value;
}
else
{
newRow["info"] = num.ToString();
newRow["color"] = this.grdMei.GetCellStyle(row, i).BackColor;
}
cellInfo.Rows.Add(newRow);
}
frm.SetDT = this.cellInfo;
frm.Location = frmMain.MousePosition;
//frm.Location = this.grdMei.HitTest().Point;
frm.ShowDialog();
}
}
private void grdMei_MouseLeaveCell(object sender, RowColEventArgs e)
{
frm.Close();
}
主要是这两个事件,你帮忙看看。工程太大了,不好发。就给你截了一部分代码 |