关于Silverlight测量单位的问题
我想构建一个小型 Silverlight 应用程序,它将 Canvas(及其子对象)保存为高分辨率 JPG 或 PNG。
我不明白如何使用 silverlight 中的单位,因为它们基于像素。如果我的目标是将 Canvas 对象保存为精确尺寸为 5" x 7" 的 JPG 或 PNG,我该如何指定 Canvas 对象的大小(以像素为单位)???
换句话说,我们如何在 Silverlight 中指定以精确英寸打印的测量值,因为不同的显示器具有不同的 DPI 值。
谢谢!!
I want to build a small Silverlight application that will save a Canvas (and it's child objects) as a high-resolution JPG or PNG.
I'm not understanding how to work with the units in silverlight since they're based on pixels. How would I go about specifying the size of the Canvas object in pixels if my goal is to save it as a JPG or PNG with the exact measurements of 5" x 7" ???
In other words, how can we specify measurement values in Silverlight that will print out in exact inches since different monitors have different DPI values.
Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Silverlight打印测量工具96 dpi意味着一英寸代表96个像素。
您可以使用 Framework 元素的 Measure 函数来获取 DesiredSize。
您可以获得更多信息[输入链接描述@
http://msdn .microsoft.com/en-us/library/system.windows.uielement.measure%28v=vs.95%29.aspx
Silverlight printing measurement implement 96 dpi means one inch represent 96 pixels.
you can use the Measure function of the Framework element to get the DesiredSize.
You can get more info [enter link description @
http://msdn.microsoft.com/en-us/library/system.windows.uielement.measure%28v=vs.95%29.aspx
理论上,宽度为 480、高度为 672 的画布在屏幕上的尺寸应为 5" x 7"。这在很大程度上取决于视频卡/显示器设备报告准确的 DPI 窗口。
但实际上,在更大的显示器上(分辨率没有按比例增加),内容看起来更大。
试图获得精确的尺寸实际上是相当困难的。
Theoretically a Canvas of Width 480 and Height 672 ought to be 5" x 7" on screen. This is heavily dependant on the Video Card / Monitor devices reporting windows an accurate DPI
However in reality what will happen is that on a bigger monitor (where the resolution has not increased proportionally) the content just looks bigger.
Trying to get exact sizes is actually quite difficult.
感谢您的回答:)
这里的链接很好地描述了我需要知道的内容:
http://www.codeproject.com/Articles/43520/Device-Independent-Units-to-Points-to-Inches
Thanks for the answers :)
Here's a link that describes very well what I needed to know:
http://www.codeproject.com/Articles/43520/Device-Independent-Units-to-Points-to-Inches