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 ...
随机推荐
- 把数据分配到view
- 2015年阿里实习生面试Java研发工程师 小记
5月5日,广州,阿里实习生面试,Java研发工程师,完全被虐orz 几乎没有Java项目开发经验,接近零基础,去水了一发,毫无悬念的被刷了..RP也是杠杠的,准备过的题目一个都没被问到,算法题也是一条 ...
- Entity Framework Tutorial Basics(31):Migration from EF 4.X
Migration from Entity Framework 4.1/4.3 to Entity Framework 5.0/6.0 To migrate your existing Entity ...
- C/C++中struct/union/class内存对齐
struct/union/class内存对齐原则有四个: 1).数据成员对齐规则:结构(struct)(或联合(union))的数据成员,第一个数据成员放在offset为0的地方,以后每个数据成员存储 ...
- mono-3.0.2安装指南
install-mono.sh.zip mono-3.0.2安装指南.pdf mod_mono.diff.zip mono-3.0.2安装指南 一见 2012/12/27 目录 1. 前言 ...
- [译]javascript中定义函数的各种方法
本文翻译youtube上的up主kudvenkat的javascript tutorial播放单 源地址在此: https://www.youtube.com/watch?v=PMsVM7rjupU& ...
- Date的转换输出
public static void main(String[] args) { // TODO Auto-generated method stub //20131111怎么格式化成2013年11月 ...
- <c:choose>标签内出错。不能写注解,否则就会报错
org.apache.jasper.JasperException: Validation error messages from TagLibraryValidator for c in /WEB- ...
- bzoj3328: PYXFIB(单位根反演+矩阵快速幂)
题面 传送门 题解 我们设\(A=\begin{bmatrix}1 & 1 \\ 1 & 0\end{bmatrix}\),那么\(A^n\)的左上角就是\(F\)的第\(n\)项 所 ...
- Linux下oracle开机自启动服务
如果每次重启操作系统都要进行以上操作好麻烦,那么如何让Oracle作为系统服务在开机的时候自动启动呢? Oracle在$ORACLE_HOME/bin下提供许多对数据库进行操作的脚本,其中dbstar ...