コード例 #1
0
        internal static void CheckAnnotationWordWrap(Form1 form, ToolStripMenuItem wordWrapToolStripMenuItem)
        {
            CustomPanel annotationPanel = ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage);

            if (annotationPanel == null)
            {
                return;
            }

            CustomRichTextBoxBase annotationTextBox = (CustomRichTextBoxBase)annotationPanel.Controls["annotationTextBox"];

            wordWrapToolStripMenuItem.Checked = !wordWrapToolStripMenuItem.Checked;
            annotationTextBox.WordWrap        = wordWrapToolStripMenuItem.Checked;
        }
コード例 #2
0
        private static void CloseAnnotationPanel(Form1 form, bool suppressMessage = false)
        {
            ToolStripMenuItem annotationPanelToolStripMenuItem = form.annotationPanelToolStripMenuItem;
            XtraTabControl    pagesTabControl = form.pagesTabControl;
            CustomPanel       annotationPanel = ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage);

            if (annotationPanel != null)
            {
                CustomRichTextBoxBase annotationTextBox = (CustomRichTextBoxBase)annotationPanel.Controls["annotationTextBox"];

                if (!String.IsNullOrEmpty(annotationTextBox.Text) && !suppressMessage)
                {
                    if (WindowManager.ShowQuestionBox(form, LanguageUtil.GetCurrentLanguageString("WarningAnnotationPanelClose", className)) == DialogResult.No)
                    {
                        return;
                    }
                }

                pagesTabControl.SelectedTabPage.Controls.Remove(annotationPanel);
            }

            ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage).Focus();
            annotationPanelToolStripMenuItem.Checked = false;
        }
コード例 #3
0
        private static void OpenAnnotationPanel(Form1 form)
        {
            ToolStripMenuItem annotationPanelToolStripMenuItem = form.annotationPanelToolStripMenuItem;
            XtraTabControl    pagesTabControl      = form.pagesTabControl;
            XtraTabPage       selectedTabPage      = pagesTabControl.SelectedTabPage;
            CustomRichTextBox pageTextBox          = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage);
            CustomPanel       annotationPanelStart = ProgramUtil.GetAnnotationPanel(selectedTabPage);

            if (annotationPanelStart != null)
            {
                selectedTabPage.Controls.Remove(annotationPanelStart);
            }

            //ContextMenuStrip
            ToolStripMenuItem undoToolStripMenuItem = new ToolStripMenuItem
            {
                Enabled          = false,
                Name             = "undoToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("UndoPanel", className)
            };
            ToolStripSeparator toolStripSeparator0 = new ToolStripSeparator
            {
                Name = "toolStripSeparator0"
            };
            ToolStripMenuItem cutToolStripMenuItem = new ToolStripMenuItem
            {
                Image            = ToolbarResource.cut,
                Name             = "cutToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("CutPanel", className)
            };
            ToolStripMenuItem copyToolStripMenuItem = new ToolStripMenuItem
            {
                Image            = ToolbarResource.copy,
                Name             = "copyToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("CopyPanel", className)
            };
            ToolStripMenuItem pasteToolStripMenuItem = new ToolStripMenuItem
            {
                Image            = ToolbarResource.paste,
                Name             = "pasteToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("PastePanel", className)
            };
            ToolStripMenuItem deleteToolStripMenuItem = new ToolStripMenuItem
            {
                Name             = "deleteToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("DeletePanel", className)
            };
            ToolStripSeparator toolStripSeparator1 = new ToolStripSeparator
            {
                Name = "toolStripSeparator1"
            };
            ToolStripMenuItem selectAllToolStripMenuItem = new ToolStripMenuItem
            {
                Name             = "selectAllToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("SelectAllPanel", className)
            };
            ToolStripMenuItem wordWrapToolStripMenuItem = new ToolStripMenuItem
            {
                Checked          = true,
                Name             = "wordWrapToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("WordWrapPanel", className)
            };
            ToolStripSeparator toolStripSeparator2 = new ToolStripSeparator
            {
                Name = "toolStripSeparator2"
            };
            ToolStripMenuItem closeToolStripMenuItem = new ToolStripMenuItem
            {
                Image            = ToolbarResource.minus,
                Name             = "closeToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("ClosePanel", className)
            };
            ToolStripMenuItem helpToolStripMenuItem = new ToolStripMenuItem
            {
                Image            = ToolbarResource.question_blue,
                Name             = "helpToolStripMenuItem",
                ShowShortcutKeys = false,
                Text             = LanguageUtil.GetCurrentLanguageString("HelpPanel", className)
            };

            undoToolStripMenuItem.Click      += CustomEvents.undoToolStripMenuItem_Click;
            cutToolStripMenuItem.Click       += CustomEvents.cutToolStripMenuItem_Click;
            copyToolStripMenuItem.Click      += CustomEvents.copyToolStripMenuItem_Click;
            pasteToolStripMenuItem.Click     += CustomEvents.pasteToolStripMenuItem_Click;
            deleteToolStripMenuItem.Click    += CustomEvents.deleteToolStripMenuItem_Click;
            selectAllToolStripMenuItem.Click += CustomEvents.selectAllToolStripMenuItem_Click;
            wordWrapToolStripMenuItem.Click  += form.wordWrapAnnotationToolStripMenuItem_Click;
            closeToolStripMenuItem.Click     += form.annotationPanelToolStripMenuItem_Click;
            helpToolStripMenuItem.Click      += form.helpAnnotationPanelToolStripMenuItem_Click;

            ToolStripRenderMode rendererMode = ConfigUtil.GetIntParameter("LookAndFeel") == 0 ? ToolStripRenderMode.ManagerRenderMode : ToolStripRenderMode.System;
            ContextMenuStrip    annotationContextMenuStrip = new ContextMenuStrip
            {
                RenderMode = rendererMode
            };

            annotationContextMenuStrip.Items.AddRange(new ToolStripItem[] { undoToolStripMenuItem, toolStripSeparator0, cutToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, deleteToolStripMenuItem,
                                                                            toolStripSeparator1, selectAllToolStripMenuItem, wordWrapToolStripMenuItem, toolStripSeparator2, closeToolStripMenuItem, helpToolStripMenuItem });
            annotationContextMenuStrip.Opening += CustomEvents.annotationContextMenuStrip_Opening;

            //Panel
            CustomPanel annotationPanel = new CustomPanel
            {
                Dock   = DockStyle.Right,
                Height = selectedTabPage.Height,
                Name   = "annotationPanel",
                Width  = annotationPanelWidth
            };
            CustomRichTextBoxBase annotationTextBox = new CustomRichTextBoxBase
            {
                AutoWordSelection = false,
                BackColor         = pageTextBox.BackColor,
                BorderStyle       = BorderStyle.None,
                ContextMenuStrip  = annotationContextMenuStrip,
                DetectUrls        = false,
                Dock      = DockStyle.Right,
                Font      = pageTextBox.Font,
                ForeColor = pageTextBox.ForeColor,
                Height    = selectedTabPage.Height,
                Multiline = true,
                Name      = "annotationTextBox",
                WordWrap  = true,
                Width     = annotationPanelWidth - 6
            };

            annotationTextBox.KeyDown += CustomEvents.annotationTextBox_KeyDown;
            annotationPanel.Controls.Add(annotationTextBox);
            selectedTabPage.Controls.Add(annotationPanel);

            annotationPanelToolStripMenuItem.Checked = true;
            annotationTextBox.Focus();
        }