Пример #1
0
        public override bool EndEdit()
        {
            RichTextEditorElement element        = this.EditorElement as RichTextEditorElement;
            RadRichTextEditor     richTextEditor = element.HostedControl as RadRichTextEditor;

            richTextEditor.Document.DocumentContentChanged -= this.OnDocumentContentChanged;

            return(base.EndEdit());
        }
Пример #2
0
        public override void BeginEdit()
        {
            base.BeginEdit();

            RichTextEditorElement element        = this.EditorElement as RichTextEditorElement;
            RadRichTextEditor     richTextEditor = element.HostedControl as RadRichTextEditor;

            richTextEditor.Document.DocumentContentChanged += this.OnDocumentContentChanged;
        }
Пример #3
0
 public static void UpdateControl(this RadRichTextEditor la, string Text)
 {
     if (la.InvokeRequired)  // if currently on a different thread, invoke
     {
         la.BeginInvoke((MethodInvoker) delegate() { la.Text = Text; });
     }
     else
     {
         la.Text = Text;
     }
 }
Пример #4
0
 private void RadGridView1_CurrentCellChanged(object sender, CurrentCellChangedEventArgs e)
 {
     if (e.NewCell != null && e.NewCell.ColumnInfo is GridViewRichTextColumn)
     {
         RichTextEditorCellElement cellElement = this.radGridView1.TableElement.GetCellElement(e.NewCell.RowInfo,
                                                                                               e.NewCell.ColumnInfo) as RichTextEditorCellElement;
         if (cellElement != null)
         {
             RichTextEditorElement element = (RichTextEditorElement)((RichTextEditor)cellElement.Editor).EditorElement;
             RadRichTextEditor     textBox = (RadRichTextEditor)element.HostedControl;
             this.richTextEditorRibbonBar1.AssociatedRichTextEditor = textBox;
             Console.WriteLine(textBox.GetHashCode());
         }
     }
 }
Пример #5
0
        public void UpdateRTF(RadRichTextEditor la, string Text)
        {
            if (la == null)
            {
                return;
            }

            if (la.InvokeRequired)  // if currently on a different thread, invoke
            {
                la.BeginInvoke((MethodInvoker) delegate() { la.Text = Text; });
            }
            else
            {
                la.Text = Text;
            }
        }
        protected override void SetContentCore(object value)
        {
            try
            {
                this.editor.Value = Convert.ToString(value);

                if (this.Value != null && this.Value != DBNull.Value && this.Value.ToString() != "")
                {
                    RichTextEditorElement element  = (RichTextEditorElement)this.editor.EditorElement;
                    RadRichTextEditor     textBox  = (RadRichTextEditor)element.HostedControl;
                    HtmlFormatProvider    provider = new HtmlFormatProvider();

                    RadDocument document = provider.Import(this.Value.ToString());
                    textBox.Document    = document;
                    document.LayoutMode = DocumentLayoutMode.Flow;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(null, ex.ToString(), "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #7
0
        //_Dict dict = new _Dict();

        #endregion

        #region === Form Update ===

        public void Update(Control Control, object update = null)
        {
            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadRichTextEditor")
            {
                RadRichTextEditor txt = (RadRichTextEditor)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadLabel")
            {
                RadLabel txt = (RadLabel)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadButton")
            {
                RadButton txt = (RadButton)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadTextBox")
            {
                RadTextBox txt = (RadTextBox)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadCheckBox")
            {
                RadCheckBox txt = (RadCheckBox)Control; // editor to update passed by user

                bool CheckVal = (bool)update;

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Checked = CheckVal; });
                }
                else
                {
                    txt.Checked = CheckVal; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "IntegrationDataUpdate.IntegrationApp")
            {
                Form txt = (Form)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadBindingNavigator")
            {
                RadBindingNavigator txt = (RadBindingNavigator)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            //if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadLabelElement")
            //{
            //    RadLabelElement txt = (RadLabelElement)Control; // editor to update passed by user

            //    string Text = ""; if (update != null) { Text = update.ToString(); }  // optional field used to pass text to populate

            //    if (txt.InvokeRequired)  // if currently on a different thread, invoke
            //    {
            //        txt.BeginInvoke((MethodInvoker)delegate () { txt.Text = Text; });
            //    }
            //    else
            //    {
            //        txt.Text = Text; // Update Control Text
            //    }

            //    return;
            //}



            ahk.MsgBox("Control Type: " + Control.GetType().ToString() + " Not Defined To Update YET");
        }