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 ...
随机推荐
- Luogu 4409 [ZJOI2006]皇帝的烦恼
BZOJ 1863 lyd口中的夹B递推. 挺妙的解法. 第一个感觉是找到一个最大的相邻的$a_i + a_{i - 1}$就可以了,但是这个想法大概只对了一半,一半的意思是说只有在$n$为偶数的时候 ...
- 获取iframe自适应后的宽高
1.同域 一:引入jquery <script type="text/javascript" src="../jquery.min.js">< ...
- 在centos上安装sequoaidb的php驱动
1:搭建PHP的运行环境 yum install httpd httpd-devel yum install php php-devel yum install php-gd php-imap p ...
- 通过委托更新UI(异步加载)
来自:http://blog.csdn.net/gongzhe2011/article/details/27351853 using System.Windows.Forms; using Syste ...
- 利用excel制作二维码
1 将想要通过扫描二维码访问的目标网址放入A1单位格 2 在excel 编辑区右击选择“自定义功能区” 3 然后将“开发者工具”选上 4 点击菜单栏的“开发者工具---插入--->其他控件” 5 ...
- selenium自动化测试、Python单元测试unittest框架以及测试报告和日志输出
部分内容来自:https://www.cnblogs.com/klb561/p/8858122.html 一.基础介绍 核心概念:test case, testsuite, TestLoder,Tex ...
- UC浏览器体验
1.用户界面: 有两个页面,一个展示网页应用-可添加自己喜欢的网页应用,另一个用来搜索,有推荐的常用的网址,有UC头条,页面下有设置,整体布局常规 2.短期刺激: 没有特别花哨的地方:个人感觉比较实用 ...
- ubuntu - 14.04,常用PPA源(第三方提供的deb格式安装文件)!!
说明: 1,下面所有PPA源的执行命令,均为在shell中执行的命令,需要依次执行! 2,下面所有测试方法,均为在shell中执行的命令!! PPA源: 一,Oracle JDK:Oracle公司提供 ...
- 基于注解的AOP配置
配置文件 spring配置文件中的约束 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns ...
- GS70 使用 Linux 下面Oracle数据库时 设定 特定目录存储数据文件
1. 创建目录 mkdir /cwdata 2. 修改目录属性 chown -R oracle:oinstall /cwdata chmod -R /cwdata 效果为: 创建数据库实例时的界面为: ...