本文整理汇总了C#中FastColoredTextBox.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# FastColoredTextBox.BeginInvoke方法的具体用法?C# FastColoredTextBox.BeginInvoke怎么用?C# FastColoredTextBox.BeginInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastColoredTextBox
的用法示例。
在下文中一共展示了FastColoredTextBox.BeginInvoke方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenTab
void OpenTab( string path )
{
foreach ( FATabStripItem page in _TabControl1.Items )
if ( page.Tag is string )
if ( ( string )page.Tag == path ) {
_TabControl1.SelectedItem = page;
return;
}
FATabStripItem faTabStripItem = new FATabStripItem( );
faTabStripItem.Title = Path.GetFileName( path );
FastColoredTextBox RB1 = new FastColoredTextBox( );
#region TextBox Properties
RB1.Dock = DockStyle.Fill;
RB1.CurrentLineColor = Color.FromArgb( 255, 255, 64 );
RB1.BackColor = Color.FromArgb( 70, 70, 70 );
RB1.ForeColor = Color.White;
RB1.PreferredLineWidth = 0;
RB1.BorderStyle = BorderStyle.FixedSingle;
RB1.Cursor = Cursors.IBeam;
RB1.ChangedLineColor = Color.DarkRed;
RB1.ChangedLineWidth = 2;
RB1.LeftBracket = '[';
RB1.LeftBracket2 = '(';
RB1.LeftBracket3 = '{';
RB1.RightBracket = ']';
RB1.RightBracket2 = ')';
RB1.RightBracket3 = '}';
RB1.BracketsStyle = RB1.BracketsStyle2 = RB1.BracketsStyle3 = new MarkerStyle( new SolidBrush( Color.FromArgb( 0, 160, 160 ) ) );
RB1.SelectionStyle.BackgroundBrush = new SolidBrush( preferencesWindow.colors[ 4 ] );
RB1.Font = preferencesWindow.f;
RB1.BorderStyle = BorderStyle.None;
RB1.IndentBackColor = Color.FromArgb( 120, 120, 120 );
RB1.LineNumberColor = Color.FromArgb( 225, 225, 225 );
#endregion
bool iswait = true;
RB1.TextChanged += new EventHandler<TextChangedEventArgs>( ( object sender, TextChangedEventArgs e ) => {
new Thread( new ThreadStart( ( ) => {
if ( !RB1.IsHandleCreated )
return;
faTabStripItem.Saved = false;
_TabControl1.BeginInvoke( new MethodInvoker( ( ) => {
_TabControl1.Invalidate( );
} ) );
if ( RB1.BackColor != Color.FromArgb( 50, 50, 50 ) )
RB1.BackColor = Color.FromArgb( 50, 50, 50 );
RB1.BeginInvoke( new MethodInvoker( ( ) => {
new Thread( new ThreadStart( ( ) => {
try {
string txt = RB1.Text;
List<Token> lineStream = tokenizer.Tokenize( new Range( RB1, 0,
RB1.Selection.Start.iLine == 0 ? 0 : RB1.Selection.Start.iLine - 1,
RB1.Lines[ RB1.Selection.Start.iLine == RB1.LinesCount - 1 ? RB1.Selection.Start.iLine : RB1.Selection.Start.iLine + 1 ].Length,
RB1.Selection.Start.iLine == RB1.LinesCount - 1 ? RB1.Selection.Start.iLine : RB1.Selection.Start.iLine + 1 ).Text
, RB1.Selection.Start.iLine == 0 ? 1 : RB1.Selection.Start.iLine );
Lexer.Lexing( ref lineStream );
PaintTextBox( RB1, lineStream );
try {
RB1.TabLength = int.Parse( preferencesWindow.tab_spaces.Text );
RB1.TabLength = 4;
if ( iswait )
System.Threading.Thread.Sleep( int.Parse( preferencesWindow.paint_delay.Text ) );
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 )
//.........这里部分代码省略.........