Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
16379 | Jul 14,2004 06:57 AM UTC | Jul 15,2004 12:30 PM UTC | WinForms | 7 |
![]() |
Tags: GridControl |
public override bool ReplaceText(string find, string replace, int rowIndex, int colIndex, GridFindTextOptions options, bool bSetCell) { bool wholeCell = (options & GridFindTextOptions.MatchWholeCell) != 0; bool matchCase = (options & GridFindTextOptions.MatchCase) != 0; GridStyleInfo style = Grid.Model[rowIndex, colIndex]; string text = style.FormattedText; CultureInfo culture = style.GetCulture(true); string text2 = text; if (!matchCase) { find = find.ToLower(culture); text2 = text.ToLower(culture); } bool found = false; if (wholeCell) { found = find.Equals(text2); if (found) { if (bSetCell) { CurrentCell.MoveTo(rowIndex, colIndex); CurrentCell.BeginEdit(); CurrentCell.Renderer.ControlText = replace; } else { Grid.Model[rowIndex, colIndex].FormattedText = replace; } } } else { int index = text2.IndexOf(find.ToString()); if (index != -1) { found = true; StringBuilder sb = new StringBuilder(); if (index > 0) sb.Append(text.Substring(0, index)); sb.Append(replace); index += find.Length; int index2 = -1; do { text2 = text.Substring(index); if (!matchCase) text2 = text2.ToLower(culture); index2 = text2.IndexOf(find.ToString()); if (index2 != -1) { if (index2 > 0) sb.Append(text.Substring(index, index2)); sb.Append(replace); index += index2 + find.Length; } } while (index2 != -1); if (index < text.Length) sb.Append(text.Substring(index)); if (bSetCell) { CurrentCell.MoveTo(rowIndex, colIndex); CurrentCell.BeginEdit(); //CurrentCell.Renderer.ControlText = sb.ToString(); activeRichTextBox.Rtf = sb.ToString(); } else { Grid.Model[rowIndex, colIndex].FormattedText = sb.ToString(); } } } return found; //return base.ReplaceText (find, replace, rowIndex, colIndex, options, bSetCell); }I do not have any further ideas on autosizing RTF. Exactly what is not working for you?
public GridFindReplaceDialogSink GridFindReplaceDialogSink { get { if (findReplaceDialogSink == null) { findReplaceDialogSink = new GridFindReplaceDialogSink(gridDataBoundGrid1); Button close = null; foreach(Control c in GridFindReplaceDialog.Instance.Controls) { if(c.Text == "Close") { close = c as Button; } } if(close != null) GridFindReplaceDialog.Instance.CancelButton = close; } return findReplaceDialogSink; } }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.