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


C# FastColoredTextBox.OpenFile方法代码示例

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


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

示例1: DelegateFctbOpenFile

 private void DelegateFctbOpenFile(FastColoredTextBox fctb, string filename, Encoding encoding)
 {
     if (fctb.InvokeRequired)
     {
         DelegateFctbOpenFileCallback d = DelegateFctbOpenFile;
         Invoke(d, fctb, filename, encoding);
     }
     else
     {
         fctb.OpenFile(filename,encoding);
     }
 }
开发者ID:cabbagecreek,项目名称:Marlin3DprinterTool,代码行数:12,代码来源:FrmMigrationCompare.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


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