private void menuSplitTextArea_Click(object sender, EventArgs e) { TextEditorControl editor = ActiveEditor; if (editor == null) { return; } editor.Split(); }
private void miSplitWindow_Click(object sender, EventArgs e) { TextEditorControl editor = ActiveEditor; if (editor == null) { return; } editor.Split(); OnSettingsChanged(); }
public override void Run() { IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveViewContent; if (viewContent == null || !(viewContent is ITextEditorControlProvider)) { return; } TextEditorControl textEditorControl = ((ITextEditorControlProvider)viewContent).TextEditorControl; if (textEditorControl != null) { textEditorControl.Split(); } }
public override void Run() { IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window == null || !(window.ViewContent is ITextEditorControlProvider)) { return; } TextEditorControl textEditorControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; if (textEditorControl != null) { textEditorControl.Split(); } }
private void miOption_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { #region 快捷菜单-选项 case "miSplitWindow": //拆分窗口 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.Split(); //OnSettingsChanged(); } break; case "miShowSpacesTabs": //显示空格和制表符 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.ShowSpaces = editor.ShowTabs = !editor.ShowSpaces; //OnSettingsChanged(); } break; case "miShowEOLMarkers": //显示换行标志 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.ShowEOLMarkers = !editor.ShowEOLMarkers; //OnSettingsChanged(); } break; case "miShowInvalidLines": //显示无效标记 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.ShowInvalidLines = !editor.ShowInvalidLines; //OnSettingsChanged(); } break; case "miShowLineNumbers": //显示行号 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.ShowLineNumbers = !editor.ShowLineNumbers; //OnSettingsChanged(); } break; case "miHLCurRow": //高亮当前行 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.LineViewerStyle = editor.LineViewerStyle == LineViewerStyle.None ? LineViewerStyle.FullRow : LineViewerStyle.None; //OnSettingsChanged(); } break; case "miBracketMatchingStyle": //高亮匹配括号当光标在其后时 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.BracketMatchingStyle = editor.BracketMatchingStyle == BracketMatchingStyle.After ? BracketMatchingStyle.Before : BracketMatchingStyle.After; //OnSettingsChanged(); } break; case "miEnableVirtualSpace": //启用虚空格 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.AllowCaretBeyondEOL = !editor.AllowCaretBeyondEOL; //OnSettingsChanged(); } break; case "miConvertTabsToSpaces": //制表符转换为空格 { TextEditorControl editor = textEditorContent; if (editor == null) { return; } editor.ConvertTabsToSpaces = !editor.ConvertTabsToSpaces; //OnSettingsChanged(); } break; case "miSetFont": //字体 { TextEditorControl editor = textEditorContent; if (editor != null) { fontDialog.Font = editor.Font; if (fontDialog.ShowDialog(this) == DialogResult.OK) { editor.Font = fontDialog.Font; // OnSettingsChanged(); } } } break; #endregion } }