在 WPF 中绘制 XAML 地图
我正在开发一个在 WPF 中显示 DWG 文件的模块。我已经设法使用 CadLib 库,但它运行速度非常慢,我想让它更快。我发现,如果我将该 DWG 文件转换为 SVG 格式,然后将其打印到 XPS 打印机并将文件重命名为 ZIP,我可以获得 .page 文件,该文件基本上是一个 XAML 文件,在 XAML 中显示原始 SVG 对象。
我想在自定义控件上显示此 XAML 代码,并能够平移/缩放它。我尝试将此 XAML 代码放置在 Canvas 中,它确实成功地显示在那里,但现在我无法平移/缩放在那里绘制的形状。此外,仅当您单击实际绘图本身而不是画布时才会触发鼠标事件,这对用户来说很难单击...
任何帮助将不胜感激:)
I'm working on a module that displays DWG files in WPF. I've managed to use CadLib library but it's working very slowly and I want to make it faster. I found out that if I convert that DWG file to SVG format and then print it to my XPS printer and rename the file to ZIP, I can get .page file which is basically a XAML file that displays the original SVG object in XAML.
I want to display this XAML code on a custom control and be able to pan / zoom it around. I tried to place this XAML code in a Canvas and it did manage to show up there, but now I'm stuck trying to pan / zoom the shape that was drawn there. Also, the mouse events are fired only when you click the actual drawing itself, and not the Canvas, which will be hard for the user to click...
Any help would be highly appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试创建嵌套的画布:一种保存矢量并根据需要移动,一种固定并用作视口。没试过,不过应该可行...
You could try creating nested Canvases : One that holds the vectors and is moved on demand, one that is fixed and serves as the viewport. Haven't tried that, but it should be feasible...