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


C# FastColoredTextBox.OnTextChanged方法代码示例

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


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

示例1: OpenTab


//.........这里部分代码省略.........
                             else
                                 iswait = true;
                         } catch {
                             MessageBox.Show( this, "Fix code editor at preferences window \r\nPath: File->Preferences->Scripts and codes" );
                             return;
                         }
                         if ( RB1.Text != txt )
                             return;
                         RB1.VisibleRange.ClearStyles( false );
                         RB1.VisibleRange.ClearFoldingMarkers( false );
                         List<Token> lt = tokenizer.Tokenize( RB1.VisibleRange.Text );
                         Lexer.Lexing( ref lt );
                         PaintTextBox( RB1, lt );
                     } catch {
                         MessageBox.Show(this, "Exception caught while painting" );
                     }
                 } ) ).Start( );
             } ) );
         } ) ).Start( );
     } );
     RB1.KeyDown += new KeyEventHandler( ( object sender, KeyEventArgs kea ) => {
         RB1.SelectionStyle.BackgroundBrush = new SolidBrush( preferencesWindow.colors[ 4 ] );
         RB1.Font = preferencesWindow.f;
         //runningForm.savedProject = false;
         int speccount = 0;
         bool isstr = false;
         int ind = RB1.Selection.Start.iChar;
         List<Char> txt = RB1[ RB1.Selection.Start.iLine ];
         txt.ForEach( new Action<Char>( ( Char c ) => {
             if ( --ind <= -1 )
                 return;
             if ( c.c == '"' || c.c == '\'' )
                 isstr = isstr == false;
         } ) );
         if ( isstr )
             return;
         string astr = RB1.Text.Substring( 0, RB1.SelectionStart );
         int startline = astr.LastIndexOf( '\n', RB1.SelectionStart - 1 );
         if ( startline == -1 )
             startline = 0;
         string astr2 = astr.Substring( startline );
         if ( kea.KeyValue == 219 && kea.Shift ) {
             kea.Handled = true;
             RB1.InsertText( " {\r\n" + new string( ' ', RB1[ RB1.Selection.Start.iLine ].StartSpacesCount + RB1.TabLength ) );
             iswait = false;
             RB1.OnTextChanged( );
         } else if ( kea.KeyValue == 8 && RB1.SelectionStart > 0 && RB1.SelectionLength == 0 ) {
             astr = RB1.Text;
             startline = astr.LastIndexOf( '\n', RB1.SelectionStart - 1 ) + 1;
             if ( astr.Substring( startline, RB1.SelectionStart - startline ) == new string( ' ', RB1.SelectionStart - startline ) ) {
                 speccount = RB1.SelectionStart - startline;
                 if ( startline != 0 )
                     speccount += 2;
                 RB1.SelectionStart -= speccount;
                 RB1.SelectionLength = speccount;
                 RB1.SelectedText = "";
                 kea.Handled = true;
             }
         } else if ( kea.KeyValue == 13 ) {
             int spaces = RB1[ RB1.Selection.Start.iLine ].StartSpacesCount;
             if ( RB1.Selection.CharAfterStart == '\n' )
                 return;
             RB1.InsertText( "\r\n" + new string( ' ', spaces ) );
             kea.Handled = true;
         } else if ( kea.KeyValue == 221 && kea.Shift ) {
             kea.Handled = true;
             int spaces = RB1[ RB1.Selection.Start.iLine ].StartSpacesCount;
             if ( astr2.Replace( " ", "" ) == "\n" ) {
                 if ( astr2.Length > RB1.TabLength + 1 ) {
                     RB1.SelectionStart -= RB1.TabLength;
                     RB1.SelectionLength = RB1.TabLength;
                     RB1.SelectedText = "}\r\n" + new string( ' ', spaces - RB1.TabLength );
                 } else {
                     RB1.SelectionStart = startline + 1;
                     RB1.SelectionLength = astr2.Length - 1;
                     RB1.SelectedText = "}\r\n";
                 }
             } else {
                 if ( spaces < RB1.TabLength + 1 ) {
                     RB1.InsertText( "\r\n}\r\n" + new string( ' ', spaces ) );
                 } else {
                     RB1.InsertText( "\r\n" + new string( ' ', spaces - RB1.TabLength ) + "}\r\n" + new string( ' ', spaces - RB1.TabLength ) );
                 }
             }
         }
     } );
     RB1.Text = File.ReadAllText( path );
     RB1.Height = RB1.Width = 2500;
     faTabStripItem.Controls.Add( RB1 );
     faTabStripItem.Tag = path;
     _TabControl1.Items.Add( faTabStripItem );
     List<Token> lt2 = tokenizer.Tokenize( RB1.Text );
     Lexer.Lexing( ref lt2 );
     PaintTextBox( RB1, lt2 );
     RB1.OnTextChanged( );
     RB1.ClearLineChanges( );
     faTabStripItem.Saved = true;
     OpenTab( path );
     _TabControl1.Invalidate( );
 }
开发者ID:VarocalCross,项目名称:Varocal,代码行数:101,代码来源:Form1.cs


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