void Adapter_ColorizeTokens(object sender, ColorizeEventArgs args) { if (_disposed) { return; } _colorizing = true; TextBox.BeginUpdate(); try { foreach (Token tkn in args.Tokens) { var tokenRange = TextBox.GetRange(tkn.Location.Position, tkn.Location.Position + tkn.Length); var tokenStyle = GetTokenStyle(tkn); tokenRange.ClearStyle(StyleIndex.All); tokenRange.SetStyle(tokenStyle); } } finally { TextBox.EndUpdate(); _colorizing = false; } }
void Adapter_ColorizeTokens(object sender, ColorizeEventArgs args) { if (_disposed) return; _colorizing = true; TextBox.BeginUpdate(); try { foreach (Token tkn in args.Tokens) { var tokenRange = TextBox.GetRange(tkn.Location.Position, tkn.Location.Position + tkn.Length); var tokenStyle = GetTokenStyle(tkn); tokenRange.ClearStyle(StyleIndex.All); tokenRange.SetStyle(tokenStyle); } } finally { TextBox.EndUpdate(); _colorizing = false; } }