Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 WPF 应用程序中使用 Scintilla 控件。当我打开应用程序并在 Scintilla 控件中键入内容时,然后从控件中复制一些文本(不将其保存在对象中),并将其粘贴到记事本中,它工作正常。
例如:我正在输入文本:
嗨, 我是 Nirbhay。 试图复制粘贴。
复制它并在记事本中粘贴后,文本是相同的。
当我将它保存在一个对象中并尝试在编辑器中重新打开它时,它也显示相同。但是当我将其复制并粘贴到记事本中时,它显示如下:
嗨,这是 Nirbhay。尝试复制粘贴。
谁能帮我解决这个问题。
我已通过将 '\n' 字符替换为 '\r\n' 来解决此问题。代码片段是:
public string Script { get { return SpecificBlock.Script.Replace("\r", "").Replace("\n", "\r\n"); } }
在第一步中,我将“\r”字符替换为空字符,然后将“\n”字符替换为“\r\n”。我这样做是因为如果有任何 '\r\n' 删除所有 '\r' 会更安全,因为我将插入所有 '\n' 的 '\r'。