Silverlight FullScreen 全屏
<UserControl x:Class="FullScreen.MainPage"
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">
<Border HorizontalAlignment="Left" VerticalAlignment="Top" Padding="10" BorderThickness="1" CornerRadius="4" Background="#7F000000">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="总CPU占用:" TextWrapping="Wrap" d:LayoutOverrides="Height" Foreground="White"></TextBlock>
<TextBlock x:Name="txtCPULoad" TextWrapping="Wrap" d:LayoutOverrides="Height" Foreground="White"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="当前CPU占用:" TextWrapping="Wrap" d:LayoutOverrides="Height" Foreground="White"></TextBlock>
<TextBlock x:Name="txtSLCPULoad" TextWrapping="Wrap" d:LayoutOverrides="Height" Foreground="White"></TextBlock>
</StackPanel>
</StackPanel>
</Border>
<Button Content="正常" Height="47" HorizontalAlignment="Left" Margin="152,123,0,0" Name="btnFull" VerticalAlignment="Top" Width="68" Click="btnFull_Click" />
</Grid>
</UserControl>
cs代码
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.Threading; namespace FullScreen
{
public partial class MainPage : UserControl
{ Analytics myAnalytics; public MainPage()
{
InitializeComponent();
Loaded += new RoutedEventHandler(MainPage_Loaded);
Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
} void MainPage_Loaded(object sender, RoutedEventArgs e)
{
myAnalytics = new Analytics();
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds();
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
} void timer_Tick(object sender, EventArgs e)
{
txtCPULoad.Text = myAnalytics.AverageProcessorLoad.ToString();
txtSLCPULoad.Text = myAnalytics.AverageProcessLoad.ToString();
} void Content_FullScreenChanged(object sender, EventArgs e)
{
var content = Application.Current.Host.Content;
if (content.IsFullScreen)
{
btnFull.Background = new SolidColorBrush(Colors.Yellow);
LayoutRoot.Background = new SolidColorBrush(Colors.Yellow);
}
else
{
btnFull.Background = new SolidColorBrush(Colors.Red);
LayoutRoot.Background = new SolidColorBrush(Colors.Red);
}
} private void btnFull_Click(object sender, RoutedEventArgs e)
{
var content = Application.Current.Host.Content;
if (!content.IsFullScreen)
{
content.IsFullScreen = !content.IsFullScreen;
btnFull.Content = "还原";
}
else
{
content.IsFullScreen = !content.IsFullScreen;
btnFull.Content = "全屏";
}
}
}
}
Silverlight FullScreen 全屏的更多相关文章
- Blazor组件提交全记录: FullScreen 全屏按钮/全屏服务 (BootstrapBlazor - Bootstrap 风格的 Blazor UI 组件库)
Blazor 简介 Blazor 是一个使用 .NET 生成的交互式客户端 Web UI 的框架.和前端同学所熟知的 Vue.React.Angular 有巨大差异. 其最大的特色是使用 C# 代码( ...
- HTML5 full-screen全屏API
这篇文章纯属记录,非常感谢张鑫旭大神的demo 原文地址: http://www.zhangxinxu.com/study/201210/html5-full-screen-api.html 代码 C ...
- UI: 窗口全屏, 窗口尺寸
窗口全屏 窗口尺寸 示例1.窗口全屏UI/FullScreen.xaml <Page x:Class="Windows10.UI.FullScreen" xmlns=&quo ...
- 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸
[源码下载] 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸 作者:webabcd 介绍背水一战 Windows 10 之 UI 窗口全屏 窗口尺寸 示例1.窗口全屏UI/F ...
- C#窗体全屏功能
最近有朋友让我给他弄个应用程序全屏的功能,例如银行的取号程序界面.所以我从网上查询了一些实现的方法. C#应用程序中如何实现全屏幕显示功能? 效果就像windows自带的屏幕保护程序和众多的游戏那样, ...
- 全屏API
by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=2679 二.相关文章以 ...
- 使用js来执行全屏
当用户按下F11事件,浏览器为触发自身全屏功能,这个过程我们一般是不可控制的,即使是监听了F11的键盘事件,退出全屏的时候,我们也捕捉不到退出全屏触发的事件.所以,我们就用程序自己去实现F11的功能, ...
- krpano下全屏后弹窗失效问题解决方法
原因 krpano 自身的全屏仅全屏自身,以外的html效果将无法显示 解决方法 把全屏按钮换成浏览器自身的全屏效果 解决步骤 vtourskin.xml <layer name="n ...
- H5视频播放自动全屏,暂停退出全屏等功能
html5视频播放自动全屏,暂停退出全屏等功能 在参考了html5 video fullScreen全屏实现方式及司徒正美的书<javascript框架设计>287页相关代码后,在Safa ...
随机推荐
- Spark的序列化
spark的序列化主要使用了hadoop的writable和java的Serializable. 说到底就是使用hadoop的writable替换了java的默认序列化实现方式. class Seri ...
- 《Head First Servlets & JSP》-1-前言
<Head First Servlets & JSP>(中文版) BB,KS & BB著, 苏钰函,林剑译,中国电力出版社 数据交互 Web浏览器和Web服务器:通过Htt ...
- Hexo下Next主题配置与优化
使用Next主题 在这里Downloads Next主题代码 将下载的代码放在myBlog/theme/next目录下 设置站点myBlog/_config.yml的theme字段值为next 生成新 ...
- ubuntu - 14.04,必须会的技能-安装PPA源中的程序,更大范围使用deb格式安装文件!!
在使用ubuntu时候,管理各种软件最方便的方式肯定是使用软件中心了,这个管理工具类似windows的 程序管理了,使用它有两个好处: 1,无需处理包依赖,linux里面程序存在各种依赖关系,这在以往 ...
- Windows10远程报错:由于CredSSP加密Oracle修正(ps:Win10家庭版)
Windows10远程桌面连接 报错信息 : 网上找到方法 但是奈何是 "Win10家庭版" 不能使用这个办法,具体操作可以看最后的引用链接 !!!! 策略路径:“计算机配置”-& ...
- java volatile 关键字(转)
volatile这个关键字可能很多朋友都听说过,或许也都用过.在Java 5之前,它是一个备受争议的关键字,因为在程序中使用它往往会导致出人意料的结果.在Java 5之后,volatile关键字才得以 ...
- Iterator 遍历器
1.遍历器(Iterator)是一种接口,为各种不同的数据结构提供统一的访问机制.任何数据结构只要部署Iterator接口,就可以完成遍历操作(即依次处理该数据结构的所有成员). 2.Iterator ...
- AngularJS(三)——指令实战及自定义指令
前言 上篇介绍了一些指令的应用,本篇介绍一些常用的用法格式. 内容 指令实战 下面通过输入一个名字实现实时更新文本内容. 需要的指令有: ng-app.ng-model.ng-bind.n-init ...
- java方法里面生成js弹出框
核心代码:方法参数要有response response.setContextType("text/html;charset=UTF-8"); PrintWrite out = r ...
- 模板:二维树状数组 【洛谷P4054】 [JSOI2009]计数问题
P4054 [JSOI2009]计数问题 题目描述 一个n*m的方格,初始时每个格子有一个整数权值.接下来每次有2种操作: 改变一个格子的权值: 求一个子矩阵中某种特定权值出现的个数. 输入输出格式 ...