首页 新闻 赞助 找找看

silverlight 自动全屏怎么实现

0
悬赏园豆:40 [已解决问题] 解决于 2009-08-04 10:02

           silverlight 自动全屏怎么实现,客户有这么个需求。就是说说在一浏览器打开后,silverlight就自动全屏,可是我看过silverlight的资料,设置全屏必须要接到客户端的响应后。不知道大家是否有好的解决方案。

 

    还有我的silverlight 脱离浏览器运行,为什么提示要下载silverlight,但是网页中运行的好好的。

糊涂而已的主页 糊涂而已 | 初学一级 | 园豆:135
提问于:2009-08-01 11:06
< >
分享
最佳答案
0

第一个问题回答如下:

从Scott Guthrie's Blog上得知,为安全之故,Silverlight不允许开发人员在应用刚装载时把应用转换成全屏模式。你可以通过点击一个按钮来处理全屏,在按钮的Click事件处理代码中加入App.Current.Host.Content.IsFullScreen = true;即可。另,我原来想通过定时器触发事件来做全屏的,经试验,没有成功。

接着,回答你的第二个问题:

前几天,我在开发时也遇到和你相同的问题。该问题的产生可能是silverlight3.0的一个bug。解决方法如下:

打开文件夹C:\Documents and Settings\用户名\Local Settings\Application Data\Microsoft\Silverlight\OutOfBrowser,再打开形如352579069.localhost(数字.localhost)的文件夹[说明:该文件夹即你安装到桌面运行的Silverlight应用程序所在的文件夹]。用写字板或其他HTML编辑器打开index.html文件,从中找到如下的代码行:

<object id='_sl' data="data:application/x-silverlight," type="application/x-silverlight" width="100%" height="100%">

将红字部分改为data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">,保存后重新双击桌面图标运行即可。

PS:关于浏览器外运行,可参考我的日志http://www.cnblogs.com/Kinglee/archive/2009/07/28/1532880.html

收获园豆:30
Kinglee | 老鸟四级 |园豆:3158 | 2009-08-01 15:25

hi,问一下,把silverlight安装到本地之后,怎一打开就是全屏的那。还有怎么禁止使用esc或者f11退出全屏那?

飞飞兔 | 园豆:151 (初学一级) | 2013-07-15 17:29
其他回答(2)
0

客户端加载时,处理:

Application.Host.Content.IsFullScreen = True ;

收获园豆:5
winzheng | 园豆:8797 (大侠五级) | 2009-08-01 12:08
0

回答问题1:

You can only switch into full-screen mode when responding to a user input event. In
other words, you can switch into full-screen mode when the user clicks a button or hits
a key. However, you can’t switch into full-screen mode as soon as your application loads
up. (If you attempt to do so, your code will simply be ignored.) This limitation is
designed to prevent a Silverlight application from fooling a user into thinking it’s actually
another local application or a system window.

摘自《Pro Silverlight2 in C# 2008》,处于对安全的考虑SL不允许自动加载全屏功能。

收获园豆:5
Gnie | 园豆:468 (菜鸟二级) | 2009-08-01 23:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册