Adding text to Scintilla without losing formatting
I'm startin开发者_C百科g development using scintilla in VB.NET and I'm creating a serial terminal program. The Scintilla control shows what data has been received in my computer serial port.
I need to programmatically add text to control.
When I use:
Scintilla1.Text = Scintilla1.text & "New Data received" & chr(13)
the text is added to Scintilla but it clears all formatting that exists in text that was in control before adding.
So, my questions:
1 - The way I'm adding text to Scintilla is correct? I did not found a method "AddText()".
2 - Why I'm losing text formatting when I add text?
You lose formatting as your assigning to Scintilla1.Text
which will replace *everything (including any styling you've applied) in the window.
As you say AddText
or AppendText
are the ways to preserve whats already there.
精彩评论