Fdream's Blog
专注于WEB前端开发
Powered by Google

Silverlight使用全屏实在是简单

23 晴天 2007-8
Fdream 发表于 Silverlight, 已被阅读 9606 次, 评论 0 条
关键词:silverlight
[ 阅读字体大小: ]

在网页中浏览视频,使用全屏播放往往能够给用户更好的体验,Silverlight对全屏支持很好,简单几行代码就能搞定全屏的问题。

BrowserHost对象有个属性就是IsFullScreen,设置其为True时就可以实现全屏,设置为False就可以退出全屏,默认情况下按ESC时就可以退出全屏。后来发现,按Alt+Tab也可以,^_*

简单的代码如下:

引用内容:

public void Page_Loaded(object o, EventArgs e)

{

//Required to initialize variables

InitializeComponent();

fullButton.MouseLeftButtonDown += new MouseEventHandler(bgRect_MouseLeftButtonDown);

}

void bgRect_MouseLeftButtonDown(object sender, MouseEventArgs e)

{

if (System.Windows.InteropBrowserHost.IsFullScreen)

{

fullButton.Text = "Click Here to FullScreen";

System.Windows.InteropBrowserHost.IsFullScreen = false;

}

else

{

fullButton.Text = "Click Here Return to Window";

System.Windows.InteropBrowserHost.IsFullScreen = true;

}

}

Related articles 您可能对这些文章也感兴趣:
Related comments 与该文相关的评论:(我也想说几句)
Add a comment 我来说两句: 
禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
表  情
arrow
用户名:   密码:  (匿名可不写) 同时注册?
验证码:   看不清?换个图片  看不清楚?换个图片

 
Copyright © 2005-2008,Fdream All Rights Reserved
Processed in 0.07815 second(s) , unknow queries
Powered by OWord V0.1, Even Not Alpha
(此博客程序为半成品,请勿索取,以免给您的心灵造成创伤^_^)
鄂ICP备05026031号