public RichTextBox() { accepts_return = true; auto_size = false; auto_word_select = false; bullet_indent = 0; base.MaxLength = Int32.MaxValue; margin_right = 0; zoom = 1; base.Multiline = true; document.CRLFSize = 1; shortcuts_enabled = true; base.EnableLinks = true; richtext = true; rtf_style = new RtfSectionStyle (); rtf_section_stack = null; scrollbars = RichTextBoxScrollBars.Both; alignment = HorizontalAlignment.Left; LostFocus += new EventHandler(RichTextBox_LostFocus); GotFocus += new EventHandler(RichTextBox_GotFocus); BackColor = ThemeEngine.Current.ColorWindow; backcolor_set = false; language_option = RichTextBoxLanguageOptions.AutoFontSizeAdjust; rich_text_shortcuts_enabled = true; selection_back_color = DefaultBackColor; ForeColor = ThemeEngine.Current.ColorWindowText; base.HScrolled += new EventHandler(RichTextBox_HScrolled); base.VScrolled += new EventHandler(RichTextBox_VScrolled); SetStyle (ControlStyles.StandardDoubleClick, false); }
// To allow us to keep track of the sections and revert formatting // as we go in and out of sections of the document. private void HandleGroup (RTF.RTF rtf) { //start group - save the current formatting on to a stack //end group - go back to the formatting at the current group if (rtf_section_stack == null) { rtf_section_stack = new Stack (); } if (rtf.Major == RTF.Major.BeginGroup) { rtf_section_stack.Push (rtf_style.Clone ()); //spec specifies resetting unicode ignore at begin group as an attempt at error //recovery. rtf_skip_count = 0; } else if (rtf.Major == RTF.Major.EndGroup) { if (rtf_section_stack.Count > 0) { FlushText (rtf, false); rtf_style = (RtfSectionStyle) rtf_section_stack.Pop (); } } }
public object Clone () { RtfSectionStyle new_style = new RtfSectionStyle (); new_style.rtf_color = rtf_color; new_style.rtf_par_line_left_indent = rtf_par_line_left_indent; new_style.rtf_rtfalign = rtf_rtfalign; new_style.rtf_rtffont = rtf_rtffont; new_style.rtf_rtffont_size = rtf_rtffont_size; new_style.rtf_rtfstyle = rtf_rtfstyle; new_style.rtf_visible = rtf_visible; new_style.rtf_skip_width = rtf_skip_width; return new_style; }