本文整理汇总了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( );
}