コード例 #1
0
        private void tabs_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.currentTextBox = tabs.SelectedRichTextBox;
            this.DisplayFileTitle();

            currentTextBox.Focus();

            // Enable the Close Tab command if and only if there is more than one tab.
            if (this.tabs.TabCount == 2)
            {
                this.closeTabButton.Enabled = false;
                closeTabTSMI.Enabled        = false;
            }
            else
            {
                this.closeTabButton.Enabled = true;
                closeTabTSMI.Enabled        = true;
            }

            saveButton.Enabled = currentTextBox.textChanged;

            filePathTSMI.Enabled = fileNameTSMI.Enabled = Path.GetDirectoryName(currentTextBox.fileName) != "";
            Debug.WriteLine(Path.GetExtension(currentTextBox.fileName));
            if (Path.GetExtension(currentTextBox.fileName) != ".rtf")
            {
                this.currentTextBox.Font = this.fontDialog.Font;
            }

            undoTSMI.Enabled  = currentTextBox.CanUndo;
            redoTSMI.Enabled  = currentTextBox.CanRedo;
            CutTSMI.Enabled   = CopyTSMI.Enabled = DeleteTSMI.Enabled = SearchTSMI.Enabled = currentTextBox.SelectedText.Length > 0;
            PasteTSMI.Enabled = currentTextBox.CanPaste(DataFormats.GetFormat(DataFormats.Text));

            lblStatus.Text = currentTextBox.StatusText;
        }
コード例 #2
0
        private void currentTextBox_SelectionChanged(object sender, EventArgs e)
        {
            lblStatus.Text    = currentTextBox.StatusText;
            pnlStatus.Visible = Properties.Settings.Default.ShowStatusBar;

            CutTSMI.Enabled   = CopyTSMI.Enabled = DeleteTSMI.Enabled = SearchTSMI.Enabled = currentTextBox.SelectedText.Length > 0;
            PasteTSMI.Enabled = currentTextBox.CanPaste(DataFormats.GetFormat(DataFormats.Text));
        }