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


C# Scintilla.BeginUndoAction方法代码示例

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


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

示例1: addTab

        private int addTab()
        {

            TabPage tab = new TabPage("Untitled        X");
            Scintilla body = new Scintilla();
            file_name.Add(null);
            ismodified.Add(false);
            hasstar.Add(false);
            charcount.Add(0);
            tabcount.Add(0);

            body.Name = "body";
            body.Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom);
            body.Margins[0].Width = 16;

            // Configuring the default style with properties
            // we have common to every lexer style saves time.
            body.StyleResetDefault();
            body.Styles[Style.Default].Font = "Manillo";
            body.Styles[Style.Default].Size = 10;
            body.Styles[Style.Default].BackColor = BackColorVar;
            body.Styles[Style.Default].ForeColor = ForeColorVar;
            body.StyleClearAll();

            if (Properties.Settings.Default.DarkMode == true)
            {
                //DARK MODE SYNTAX HIGHLIGHTING SETTING
                body.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(87, 166, 74); // Green
                body.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(87, 166, 74); // Green
                body.Styles[Style.Cpp.Word].ForeColor = Color.FromArgb(38, 139, 210); //Blue
                body.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(220, 50, 47); // Red
                body.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(220, 50, 47); // Red
                body.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(220, 50, 47); // Red
            }
            else if (Properties.Settings.Default.DarkMode == false)
            {
                //LIGHT MODE SYNTAX HIGHLIGHTING SETTINGS
                body.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0); // Green
                body.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0); // Green
                body.Styles[Style.Cpp.Word].ForeColor = Color.Blue;
                body.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21); // Red
                body.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21); // Red
                body.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21); // Red
            }

            // Configure the CPP (C#) lexer styles
            body.Styles[Style.Cpp.Default].ForeColor = Color.Silver;
            body.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128); // Gray
            body.Styles[Style.Cpp.Number].ForeColor = Color.Olive;
            body.Styles[Style.Cpp.Word2].ForeColor = Color.Magenta;
            body.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
            body.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
            body.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Maroon;
            body.IndentationGuides = IndentView.LookBoth;
            body.Styles[Style.BraceLight].BackColor = Color.LightGray;
            body.Styles[Style.BraceLight].ForeColor = Color.BlueViolet;
            body.Styles[Style.BraceBad].ForeColor = Color.Red;
            body.Styles[Style.LineNumber].BackColor = BackColorVar;
            body.Lexer = Lexer.Cpp;

            // Set the keywords. 0 is functions, 1 is variables
            body.SetKeywords(0, Keywords.Key0());
            body.SetKeywords(1, Keywords.Key1());

            body.CaretLineBackColor = Color.White;
            body.CaretForeColor = ForeColorVar;

            body.CharAdded += new System.EventHandler<ScintillaNET.CharAddedEventArgs>(this.scintilla_CharAdded);
            body.UpdateUI += new System.EventHandler<ScintillaNET.UpdateUIEventArgs>(this.scintilla_UpdateUI);
            body.TextChanged += new System.EventHandler(this.scintilla_TextChanged);
            body.KeyDown += new System.Windows.Forms.KeyEventHandler(this.scintilla_KeyDown);

            body.BeginUndoAction();
            body.IndentWidth = 0;

            tab.Controls.Add(body);
            tabControl1.TabPages.Add(tab);
            int i = tabControl1.TabCount - 1;
            tabControl1.SelectedIndex = i;
            return i;
        }
开发者ID:TN-1,项目名称:Kode_Desktop,代码行数:81,代码来源:Form1.cs


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