当前位置: 首页>>代码示例>>C#>>正文


C# FastColoredTextBox.Focus方法代码示例

本文整理汇总了C#中FastColoredTextBox.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# FastColoredTextBox.Focus方法的具体用法?C# FastColoredTextBox.Focus怎么用?C# FastColoredTextBox.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FastColoredTextBox的用法示例。


在下文中一共展示了FastColoredTextBox.Focus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindPrevDiff

 public void FindPrevDiff(FastColoredTextBox tb)
 {
     int oldLine = tb[tb.Selection.Start.iLine].LineNo - 1;
     int newLine = oldLine;
     List<int> list = tb == tb1 ? RedLines1 : GreenLines2;
     for (int i = list.Count - 1; i >= 0; i--) {
         if (list[i] < oldLine) {
             newLine = list[i];
             break;
         }
     }
     if (oldLine != newLine)
         tb.NavigateToLineNum(newLine + 1, true);
     tb.Focus();
 }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:15,代码来源:DiffControl.cs

示例2: CreateTab

        private void CreateTab(string fileName)
        {
            if (ScriptCommunityPack.keywordsInformation.Count == 0)
            {
                MessageBox.Show("primarily load keywords");
                return;
            }
            try
            {
                FastColoredTextBox tb = new FastColoredTextBox();
                tb.AutoScroll = true;
                tb.BorderStyle = BorderStyle.None;
                tb.Font = new Font("Consolas", 9.75f);
                tb.BackgroundImage = Properties.Resources.bg1;
                tb.ForeColor = Color.White;
                tb.LineNumberColor = Color.White;
                tb.IndentBackColor = Color.FromArgb(80, Color.Gray);
                tb.ContextMenuStrip = cmMain;
                tb.Dock = DockStyle.Fill;
                tb.LeftPadding = 5;
                tb.Language = Language.Scp;
                tb.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(50, Color.Gray))));//same words style
                if (fileName != null)
                    tb.OpenFile(fileName);
                tb.Name = Path.GetFileName(fileName);
                tb.ClearUndo();
                tb.Tag = new PopupMenu();
                tb.Focus();
                tb.DelayedTextChangedInterval = 1;
                tb.DelayedEventsInterval = 500;
                tb.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(tb_TextChangedDelayed);
                tb.SelectionChangedDelayed += new EventHandler(tb_SelectionChangedDelayed);
                tb.ToolTipNeeded += tb_ToolTipNeeded;
                tb.KeyDown += new KeyEventHandler(tb_KeyDown);
                tb.MouseMove += new MouseEventHandler(tb_MouseMove);
                tb.ChangedLineColor = changedLineColor;
                if (btHighlightCurrentLine.Checked)
                    tb.CurrentLineColor = currentLineColor;
                tb.ShowFoldingLines = btShowFoldingLines.Checked;
                tb.HighlightingRangeType = HighlightingRangeType.VisibleRange;
                AutocompleteMenu popupMenu = new AutocompleteMenu(tb);
                popupMenu.Items.ImageList = ilAutocomplete;
                popupMenu.Opening += new EventHandler<CancelEventArgs>(popupMenu_Opening);
                BuildAutocompleteMenu(popupMenu);
                (tb.Tag as PopupMenu).popupMenu = popupMenu;
                tb.ToolTip.OwnerDraw = true;
                tb.ToolTip.Draw += ToolTip_Draw;
                tb.ToolTip.Popup += ToolTip_Popup;
                MSATabPage newPagem = new MSATabPage(tb, fileName != null ? Path.GetFileName(fileName) : "[new]");
                newPagem.Tag = fileName;
                newPagem.MSATabPageClosing += NewPagem_MSATabPageClosing;
                msaTabControl1.MSATabPageClosed += msaTabControl1_MSATabPageClosed;
                msaTabControl1.SelectedPageChanged += MsaTabControl1_SelectedPageChanged;
                msaTabControl1.AddPage(newPagem);
                documentMap1.BackgroundImage = tb.BackgroundImage;
                documentMap1.Target = tb;
            }
            catch (Exception ex)
            {
                if (MessageBox.Show(ex.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.Retry)
                    CreateTab(fileName);

                return;
            }
            msaTabControl1.SelectedPage.Tag = fileName;
        }
开发者ID:msx752,项目名称:ScriptCommunityPack-Editor,代码行数:66,代码来源:REditor.cs

示例3: FindNextDiff

 public void FindNextDiff(FastColoredTextBox tb = null)
 {
     if (tb == null) tb = tb1.Focused ? tb1 : tb2;
     int oldLine = tb[tb.Selection.Start.iLine].LineNo - 1;
     int newLine = oldLine;
     List<int> list = tb == tb1 ? RedLines1 : GreenLines2;
     foreach (var e in list) {
         if (e > oldLine) {
             newLine = e;
             break;
         }
     }
     if (oldLine != newLine)
         tb.NavigateToLineNum(newLine + 1, true);
     tb.Focus();
 }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:16,代码来源:DiffControl.cs

示例4: createNewContainet

        private TabPage createNewContainet(string name, string fullPath = null, bool saved = false)
        {
            //create new tab
             TabPage newPage = new TabPage(name);
             tabContainer.TabPages.Add(newPage);

             SplitContainer container = new SplitContainer();
             container.Orientation = Orientation.Horizontal;
             container.Dock = DockStyle.Fill;
             newPage.Controls.Add(container);

             //create output console
             OutputConsole console = new OutputConsole();
             console.Name = "outputConsole";
             console.Dock = DockStyle.Fill;
             container.Panel2.Controls.Add(console);
             container.Panel2Collapsed = true;

             //create new editor
             var newEditor = new FastColoredTextBox();
             newEditor.Name = "mainEditor";
             newEditor.DelayedTextChangedInterval = 1000;
             newEditor.DelayedEventsInterval = 500;
             newEditor.Language = FastColoredTextBoxNS.Language.wQL;
             newEditor.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(editor_TextChangedDelayed);
             newEditor.TextChanged += new EventHandler<TextChangedEventArgs>(editor_TextChanged);
             newEditor.SelectionChangedDelayed += new EventHandler(editor_SelectionChangedDelayed);
             newEditor.ToolTipNeeded += NewEditor_ToolTipNeeded;
             newEditor.Name = ProjectConstants.EditorControlName;
             container.Panel1.Controls.Add(newEditor);
             //newPage.Controls.Add(newEditor);
             newEditor.CurrentLineColor = highlightCurrentLineToolStripMenuItem.Checked ? currentLineColor : Color.Transparent;
             newEditor.HighlightingRangeType = HighlightingRangeType.VisibleRange;
             newEditor.AddStyle(sameWordsStyle);//same words style
             newEditor.Dock = DockStyle.Fill;

             AutocompleteMenu popupMenu = new AutocompleteMenu(newEditor);
             //popupMenu.Items.ImageList = ilAutocomplete;
             popupMenu.Opening += new EventHandler<CancelEventArgs>(popupMenu_Opening);
             BuildAutocompleteMenu(popupMenu);
             newEditor.Tag= popupMenu;

             tabContainer.SelectedTab = newPage;

             //create the details for the file
             var details = new FileDetails()
             {
            FileName = name,
            FullPath = fullPath,
            Saved = saved
             };

             newPage.Tag = details;

             updateTab(newPage);

             newEditor.BringToFront();
             newEditor.Focus();

             return newPage;
        }
开发者ID:zuun,项目名称:wSQL,代码行数:61,代码来源:frmMain.cs


注:本文中的FastColoredTextBox.Focus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。