/// <summary> /// 向上查找输入的信息 /// </summary> private void btnPrevious_Click(object sender, EventArgs e) { try { if (textContent.Text.Trim() == "") { return; } int locationRowNo = browseXtraGridView.FocusedRowHandle; int locationColumnNo = browseXtraGridView.FocusedColumn.AbsoluteIndex; textContent.Focus(); browseXtraGridView.Focus(); for (int i = locationRowNo; i >= 0; i--) { for (int j = locationColumnNo - 1; j >= 0; j--) { if (!browseXtraGridView.Columns[j].Visible) { continue; } string cellValue = DataTypeConvert.GetString(browseXtraGridView.GetRowCellDisplayText(i, browseXtraGridView.Columns[j])); if (cellValue.Contains(textContent.Text.Trim())) { browseXtraGridView.FocusedRowHandle = i; browseXtraGridView.FocusedColumn = browseXtraGridView.Columns[j]; GridViewInfo vi = browseXtraGridView.GetViewInfo() as GridViewInfo; GridDataRowInfo rowInfo = vi.RowsInfo.GetInfoByHandle(i) as GridDataRowInfo; GridCellInfo cellInfo = rowInfo.Cells[0]; if (cellInfo != null) { cellInfo.State = GridRowCellState.FocusedCell; } return; } else { continue; } } locationColumnNo = browseXtraGridView.Columns.Count; } } catch (Exception ex) { //ExceptionHandler.HandleException(this.Text + "--向上查找输入的信息错误。", ex); ExceptionHandler.HandleException(this.Text + "--" + f.tsmiXsczsrdxxcw.Text, ex); } }