没关系,我没有回的帖子我都记着呢。参考下面的代码,看是否解决了你的问题?
- private void multiRowSheet1_LeaveCell(object sender, GrapeCity.Win.ElTabelle.MLeaveCellEventArgs e)
- {
- int columnIndex = -1;
- int rowIndex = -1 ;
- if (this.multiRowSheet1.ActiveCell.Key == "ButtonEditor") //假定你的ButtonEditor所在的Cell的Key是"ButtonEditor"
- {
- //获得第四列Cell的RowIndex和ColumnIndex
- GetColumnRowIndexFromKey("lblKingaguNameHarai", ref columnIndex, ref rowIndex);
- //下面的代码指定跳到当前行的第四列
- e.NewPosition = new MPosition(this.multiRowSheet1.ActiveMRowIndex, columnIndex, rowIndex);
- }
- }
- //这个方法的意思是知道一个Cell的Key,来找出它的RowIndex和ColumnIndex
- private void GetColumnRowIndexFromKey(string key, ref int columnIndex, ref int rowIndex)
- {
- Template t = this.multiRowSheet1.Template;
- for (int i = 0; i < t.Cells.MaxColumns; i++)
- {
- for (int j = 0; j < t.Cells.MaxRows; j++)
- {
- if (t.Cells[i, j].Key == key)
- {
- columnIndex = i;
- rowIndex = j;
- return;
- }
- }
- }
- }
复制代码 |