开发者

Adding text to Scintilla without losing formatting

开发者 https://www.devze.com 2022-12-31 01:43 出处:网络
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'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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号