Wpf inkcanvas 保存和检索文本
您好,我正在尝试在 wpf 中实现类似 mspaint 的应用程序。我已经通过实现自定义笔画类成功实现了大部分基本绘图功能。现在我正在尝试从 mspaint 实现文本插入选项。我尝试使用 DrawingContext 来实现.DrawText,它工作正常,但是当我将笔画保存到 isf 文件并重新加载绘图时,所有绘图都已加载,但文本未恢复。请帮助我。
Hi I am trying to implement a mspaint like application in wpf.I have successfully implemented most of the basic drawing functionalities by implementing a custom stroke class.Now I am trying to implement the Text inserting option from mspaint.I have tried to implement using DrawingContext.DrawText,it is working alright but when I save the strokes to an isf file and reloading the drawing,all the drawing is loaded but the text is not restored.Please help me on the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕文本是儿童收藏的成员。您要求进行序列化和反序列化的 StrokeCollection 对此一无所知。您将必须自己构建序列化逻辑,或者通过 DataContractFormatter,或者您喜欢的任何排列。
I'm afraid the Text is a member of the Children collection. Your StrokeCollection, which is what you're asking to do the serializing and deserializing, doesn't know anything about it. You're going to have to build serialization logic yourself, or go through a DataContractFormatter, or whatever permutation of same you prefer.