开发者

Question on Silverlight's Unit of Measurements

开发者 https://www.devze.com 2023-03-31 14:27 出处:网络
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 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 u开发者_开发百科nits 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!!


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消