前台页面代码:
<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; } } }
总结以上是内存溢出为你收集整理的silverlight全屏显示图片全部内容,希望文章能够帮你解决silverlight全屏显示图片所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)