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 ...
随机推荐
- p3295 [SCOI2016]萌萌哒
传送门 分析 我们可以将一个点拆成logN个点,分别代表从点i开始,长度为2^k的子串 那么当我们处理两个区间相等的关系时,对区间做二进制拆分,拆成log个区间,分别并起来即可 当然我们这样做修改是省 ...
- cf123E Maze
传送门 分析 见ptx大爷的博客 代码 #include<iostream> #include<cstdio> #include<cstring> #include ...
- Javascript parseInt()和parseFloat()的用法
parseInt()方法首先查看位置0处的 字符,判断它是否是个有效数字:如果不是,该方法将返回NaN,不再继续执行其他操作.但如果该字符是有效数字,该方法将查看位置1处的字符,进行同样的 测试.这一 ...
- android listview addHeaderView和addFooterView的注意事项
1. item内如果有button等控件时,在监听listview的onitemclick事件时,焦点会被item内的button. imagebutton等控件抢走,从而导致在listview设置了 ...
- DjVu转PDF
作者:马健邮箱:stronghorse_mj@hotmail.com发布:2009.09.22更新:2012.06.11针对PdfToy的新进展,更新了相关内容. 1 引言2 理论3 实现 3. ...
- .Net Core Api 使用版本控制
1,安装Microsoft.AspNetCore.Mvc.Versioning NET Core Mvc中,微软官方提供了一个可用的Api版本控制库Microsoft.AspNetCore.Mvc.V ...
- SourceTree——MAC OSX下的Git GUI客户端
在MAC下面为Git找一款用得顺手的GUI客户端还真不容易.学习工具使用还是先器而后道的路径比较适合我,当年上手CVS SVN都是如此,先通过tortoise客户端熟练了基本操作,之后在搭建构建平台的 ...
- Vue Study [2]: Vue Router
Description The article for vue router. Original post link:https://www.cnblogs.com/markjiang7m2/p/10 ...
- 使用Unity的2D功能开发弹球游戏
https://mp.weixin.qq.com/s/7xjysNDVHe7avF1v2NZWcg
- [SinGuaRiTy] 2017-07-24 NOIP2015 模拟赛
[SinGuLaRiTy-1030] Copyright (c) SinGuLaRiTy 2017. All Rights Reserved. 对于所有题目: Time Limit: 1s | Mem ...