Example #1
0
        private void UpdateListOfTextBlocksPanel()
        {
            flpGuideTableOfContent.SuspendLayout();
            flpGuideTableOfContent.Controls.Clear();
            var index = 0;

            foreach (var textblock in currentGuide)
            {
                var plainTextBlock = TextBlockUtil.FindPlainTextBox(textblock);
                var tbr            = new Label()
                {
                    BorderStyle      = BorderStyle.FixedSingle,
                    ContextMenuStrip = cmsForTextBlock,
                    Cursor           = Cursors.Hand,
                    Location         = new Point(3, 3),
                    Margin           = new Padding(3),
                    Padding          = new Padding(4, 0, 0, 0),
                    Size             = new Size(flpGuideTableOfContent.ClientSize.Width - 6, 23),
                    Dock             = (index == 0 ? DockStyle.None : DockStyle.Top),
                    TabIndex         = index,
                    Text             = plainTextBlock.Text,
                    TextAlign        = ContentAlignment.MiddleLeft,
                    Tag = textblock
                };
                tbr.Click      += TextBlockRef_Click;
                tbr.MouseDown  += TextBlockRef_MouseDown;
                tbr.MouseEnter += TextBlockRef_MouseEnter;
                tbr.MouseLeave += TextBlockRef_MouseLeave;
                index++;
                flpGuideTableOfContent.Controls.Add(tbr);
            }
            flpGuideTableOfContent.ResumeLayout();
        }
        public EditTextBlockForm(TextBlock tb, Font font)
        {
            defaultFont    = font;
            textBlock      = tb;
            plainTextBlock = TextBlockUtil.FindPlainTextBox(tb);
            InitializeComponent();
            initialText   = plainTextBlock.Text;
            rtbEntry.Text = initialText;
            chbUnderline.CheckedChanged -= ChbUnderline_CheckedChanged;
            var underlineDec = TextBlockDecorator.FindDecorator <UnderlineDecorator>(tb);

            if (underlineDec == null)
            {
                chbUnderline.Checked = false;
            }
            else
            {
                chbUnderline.Checked = (underlineDec.Underline == UnderlineDecorator.UnderlineType.Single);
            }
            chbUnderline.CheckedChanged += ChbUnderline_CheckedChanged;
            UpdateView();
            rtbEntry.Focus();
        }