Exemple #1
0
        /// <summary>
        /// The find dialog has requested a replace operation on the most recently selected text
        /// </summary>
        private void findDialog1_ReplaceRequested(object sender, ReplaceEventArgs e)
        {
            // Unfortunately it does not seem possible to register this in the TextBox's undo stack
            SelectedText = e.ReplaceText;

            if (findDialog1.ReplaceAvailable)
            {
                textAfterReplace = Text;
            }
        }
        /// <summary>
        /// Start a replace operation on the last selected text
        /// </summary>
        /// <param name="replaceText">The string to replace</param>
        internal void Replace(string replaceText)
        {
            ReplaceEventArgs args = new ReplaceEventArgs();

            args.ReplaceText = replaceText;

            if (replaceRequested == null)
            {
                throw new Exception("No replace event handler supplied");
            }
            replaceRequested(this, args);
        }