silverlight全屏显示图片
2012-10-16 12:32:04 来源:WEB开发网 前台页面代码:
<UserControl x:Class="SilverlightApplicationDome.fullScreenDome"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Image Name="full" Source="img/3.jpg" Stretch="UniformToFill"></Image>
<Button Name="btnFull" Width="120" Height="80" Content="全屏显示" FontSize="24" Click="btnFull_Click"></Button>
</Grid>
</UserControl>
其实很简单,我们只需要引用命名空间,System.Windows.Interop就可以了。
后台代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interop;
namespace SilverlightApplicationDome
{
public partial class fullScreenDome : UserControl
{
public fullScreenDome()
{
InitializeComponent();
}
private void btnFull_Click(object sender, RoutedEventArgs e)
{
Content contentObject = Application.Current.Host.Content;
contentObject.IsFullScreen = !contentObject.IsFullScreen;
}
}
}
Tags:silverlight 显示 图片
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››图片处理 放大 或是旋转
- ››图片延迟加载并等比缩放,一个简单的JQuery插件
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››显示关闭还原 Win 7任务栏小技巧
- ››图片格式无阻碍 美图看看无忧看图
- ››Silverlight for Symbian
- ››图片处理问题之去除照片日期水印
更多精彩
赞助商链接