/// <summary> /// Sample customization for implementing the Find and Replace dialog /// </summary> private void SampleCustomization() { EnableControls(false); this.gridControl1.ColCount = 20; //Populate the grid control Random r = new Random(); for (int i = 1; i <= gridControl1.RowCount; i++) { for (int j = 1; j <= gridControl1.ColCount; j++) { gridControl1[i, j].Text = r.Next(100, 150).ToString(); } } //Setup FindReplace dialog frDialog = new GridFindReplaceDialogSink(gridControl1); //Initial Settings options = GridFindTextOptions.None; cmbOptions.SelectedIndex = 2; this.gridControl1.ForceCurrentCellMoveTo = true; this.gridControl1.ThemesEnabled = true; this.gridControl1.CurrentCell.MoveTo(1, 1); //tab key navigation set as false to move the next control this.gridControl1.WantTabKey = false; }
public GridFindReplaceDialog(GridGroupingControl groupinggrid, string themeStyle) { // // Required for Windows Form Designer support // InitializeComponent(); //System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"Common\Images\Grid\Icon\sficon.ico")); //this.Icon = ico; grid = groupinggrid; frDialog = new GridFindReplaceDialogSink(grid.TableControl); options = GridFindTextOptions.None; this.comboBox1.SelectedIndex = 0; grid.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(grid_QueryCellStyleInfo); this.Icon = new System.Drawing.Icon(GetIconFile(@"Common\Images\Grid\Icon\sficon.ico")); }
//FindAll - Loops through the cells in the grid and highlights all the values //that match with the given search string. private void btnFindAll_Click(object sender, EventArgs e) { if (cmbSearch.Text != null) { AddToSearchedList(cmbSearch.Text); SetOptions(); locInfo = GridRangeInfo.Table(); GridRangeInfo selRange = GridRangeInfo.Empty; int rowIndex, colIndex; if ((options & GridFindTextOptions.SelectionOnly) != GridFindTextOptions.None) { selRange = gridControl1.Selections.Ranges.ActiveRange; } else if ((options & GridFindTextOptions.ColumnOnly) != GridFindTextOptions.None) { selRange = GridRangeInfo.Col(gridControl1.CurrentCell.ColIndex); } else if ((options & GridFindTextOptions.WholeTable) != GridFindTextOptions.None) { selRange = GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount); } clearHighlight(); int startTop = selRange.Top; int startLeft = selRange.Left; do { GridStyleInfo style = gridControl1[startTop, startLeft]; GridCellRendererBase renderer = gridControl1.CellRenderers[style.CellType]; if (renderer.FindText(cmbSearch.Text, startTop, startLeft, options, true)) { gridControl1.CurrentCell.GetCurrentCell(out rowIndex, out colIndex); gridControl1[rowIndex, colIndex].BackColor = Color.Orange; } } while (GridFindReplaceDialogSink.GetNextCell(selRange, ref startTop, ref startLeft, false, chkSearchUp.Checked)); } this.highlighttext.HighlightText = ""; this.gridControl1.Refresh(); this.checkBox1.CheckState = CheckState.Unchecked; }
public ФункцииПоиска(ТаблицаОтчетнойФормы ТаблицаФормы) { this.таблицаФормы = ТаблицаФормы; this.findDialog = new GridFindReplaceDialogSink(this.таблицаФормы); }