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.
我想要的是当我打印一个文档(这是数据库中的一条记录)时,这个文档不能再被用户更新,所以我想如果我能捕获打印事件并将打印字段设置为 true记录因此当用户尝试更新操作将被取消。你们有什么想法吗?谢谢
你可以这样做:
void PrintDocument(IDocument document) { if (document.IsPrinted) { return; } // now print the document document.IsPrinted = true; SaveDocument(document); }
如果您想要更合理的代码,或者不想在您的项目中实现它,也许您的相关代码和您遇到问题的部分会有所帮助。