Silverlight 3:调整屏幕分辨率的技术
我的开发者盒子的屏幕分辨率为 1680 x 1050。我正在开发一个全屏 Silverlight 3 应用程序,并考虑将其部署到 Internet。因此,我想确保应用程序在各种屏幕分辨率下看起来都不错。我刚刚开始在其他盒子上进行测试,第一个盒子的屏幕分辨率为 1024 x 768。在测试过程中,我发现应用程序上的一些页面被部分截断。页面上的控件似乎没有针对较低的屏幕分辨率进行调整。因此,我正在寻找一些有关如何制作 Silverlight 应用程序的提示,尽可能调整屏幕分辨率。例如,为了更轻松地适应屏幕分辨率,在 XAML 上是否应该执行或不执行某些操作?我应该优化最低屏幕分辨率吗?欢迎您的想法和建议。
My developer's box has a screen resolution of 1680 x 1050. I'm developing a full-screen Silverlight 3 application that I'm considering deploying to the Internet. So, I want to make sure the application looks good on a variety of screen resolutions. I just started testing on other boxes, the first one having a screen resolution of 1024 x 768. During the test I found some of the pages on the application were partially truncated. It seems the controls on the page didn't adjust for the lower screen resolution. So, I'm looking for some tips on how to make a Silverlight application, to the extent possible, adjust for screen resolution. For example, are there things one should or should not do on XAML to make adapting to screen resolution easier? Should I just optimize for a minimum screen resolution? Your thoughts and suggestions are welcomed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MinHeight
和MinWidth
属性轻松强制执行可接受的最低分辨率。 (当然,这应该小于考虑浏览器镶边的最小屏幕分辨率。)Width
和Height
:例如,对于图像或固定尺寸的图标,或用于明显的情况,例如TextBox
es(其宽度应反映输入数据的平均长度)。MinHeight
andMinWidth
properties of your root visual. (Of course, this should be less than the minimum screen resolution to account for browser chrome.)Width
andHeight
only when necessary: for example, for images or icons of fixed dimensions, or for obvious cases likeTextBox
es (whose width should reflect the average length of the data entered).Grid
panels are excellent for mixing scalable and fixed layout areas. The star sizing specification takes a bit of getting used to--it's not as simple as a percentage-based proportioning--but it's much more flexible, especially in combination with row/column min/max dimensions.您可以使用 Silverlight Toolkit ViewBox 来扩展应用程序,或者使用 Grid、StackPanel 和 WrapPanel 等布局控件来扩展应用程序。使您的主 UserControl 的宽度和高度为 Auto(或完全删除宽度和高度),应用程序的大小将调整为父 div 的大小(默认 HTML 模板使用 100%x100%)。然后只需相应地调整浏览器的大小即可。 IE8 具有开发人员工具,可以帮助您查看将应用程序调整为特定屏幕分辨率的大小。
在各种屏幕分辨率上进行测试始终是一个好主意。
You can make your application scale with the Silverlight Toolkit ViewBox or make it strech with layout controls like the Grid, StackPanel, and WrapPanel. Make your main UserControl have a Width and Height of Auto (or remove the width and height entirely) and the size of the app will resize to the size of the parent div (the default HTML template uses 100%x100%). Then just resize the browser accordingly. IE8 has developer tools that can help you see your app resized to specific screen resolutions.
Testing on a variety of screen resolutions is always a good idea.
我介绍了元素大小的调整以及使其分辨率独立于另一个线程。
您可以查看这里,有多种方法可以调整大小和调整大小自动地。
I covered the resizing of elements and making it resolution independent on another thread.
You can have a look here, there are multiple ways to sizing and resizing things automatically.