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 ...
随机推荐
- CF 671D Roads in Yusland
弄完之后点进去一看,竟然是div1的D题……最近真是天天被题虐哭 推荐这一篇博客 https://www.cnblogs.com/Sakits/p/8085598.html 感觉讲清楚了,也是基本照着 ...
- python3-字典中包含字典
# Auther: Aaron Fan #定义字典及内容av_catalog = { "欧美":{ "www.youporn.com": ["很多免费 ...
- 数据结构_Search
问题描述 可怜的 Bibi 刚刚回到家,就发现自己的手机丢了,现在他决定回头去搜索自己的手机.现在我们假设 Bibi 的家位于一棵二叉树的根部.在 Bibi 的心中,每个节点都有一个权值 x,代表他心 ...
- LeetCode第35题:搜索插入位置
题目描述: 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引.如果目标值不存在于数组中,返回它将会被按顺序插入的位置. 你可以假设数组中无重复元素. 示例 1: 输入: [1,3,5,6 ...
- C++面试笔记--字符串
基本上求职者进行笔试没有不考字符串的.字符串也是一种相对简单的数据结构,容易被考.事实上,字符创也是一个考验程序猿编程规范和编程习惯的重要考点. 1.替换空格:实现一个函数,把字符串中的每个空格替换成 ...
- maven-排除传递依赖-exclusions
在maven项目中引用dubbo的maven依赖的时候会引入dubbo中传递依赖的spring的依赖包如下: <!-- dubbo相关的jar包 --> &l ...
- Docker+Jenkins+Gogs 自动构建.Net Core
Docker+Jenkins+Gogs 自动构建.Net Core 引言 jenkins+gags 全部采用Docker安装,通过jenkins插件ssh调用外部Docker构建 主要实现功能: gi ...
- 动态绑数据(GridView控件Header和ItemTemplate)
想了解此篇文章,建议先预习一下<动态变更GridView控件列名>http://www.cnblogs.com/insus/p/3232057.html,因为多少有些关联.不管怎样,它能够 ...
- Mysql union
union简单来说就是多表链接,主要是用于(模糊)查询,全库搜索 多表搜索需要先将需要查询的表用union连接,然后在每一个union后面添加上相同的where条件 菜鸟教程
- P4234 最小差值生成树 LCT维护边权
\(\color{#0066ff}{ 题目描述 }\) 给定一个标号为从 \(1\) 到 \(n\) 的.有 \(m\) 条边的无向图,求边权最大值与最小值的差值最小的生成树. \(\color{#0 ...