使用嵌入式资源
我有一个与 Visio 绘图控件配合使用的应用程序,它需要使用带有形状的文件来进行 Visio 绘图。我想将该文件 (stencil.vss) 嵌入到我的应用程序中,这样我在分发应用程序时就不必提供我的模板文件。我不知道如何在代码中访问该文件。我的函数需要文件路径来加载该 .vss 文件,所以我真正不知道的是,当该文件与应用程序一起编译时,我如何获取它的路径,因为我需要提供一个字符串作为函数参数。
I have an application that works with Visio drawing control and it needs to use a file with shapes for Visio drawing. I want to embed that file (stencil.vss) into my application so that I don't have to provide my stencil file when distributing application. I don't know how to access that file in code. My function needs file path to load that .vss file, so really what I don't know is, when that file is compiled along with application, how can I get it's path, because I need to provide a string as function parameter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,您确实需要提供 Visio API 的文件系统路径才能打开 *.vss 模板文件。
您如何将其嵌入到您的应用程序中?也许您可以从其嵌入位置读取它,并将其写入用户应用程序数据位置,然后在按用户将其写入磁盘后引用它。
To the best of my recollection, you do need to provide a file system path to the Visio API in order to open a *.vss stencil file.
How are you embedding it in your application? Perhaps you could read it from its embedded location, and write it out to a user app data location, and then reference it after it's written out to disk on a per-user basis.