Powershell演示WPF弹窗
来源:互联网 发布:js超出两行显示省略号 编辑:程序博客网 时间:2024/05/17 14:20
WPF (Windows Presentation Foundation) 技术能让你创建窗口和对话框。它的优势是在窗体设计时能与代码分开。
这里有个简单的显示弹出消息练习。这个消息是定义在XAML代码中它的实现类似HTML(但是请区分大小写)。你能轻松的调整字体大小,内容,颜色等等。不需要嵌入任何代码。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$xaml
=
@"
<Window
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<Border BorderThickness="20" BorderBrush="Yellow" CornerRadius="9" Background='Red'>
<StackPanel>
<Label FontSize="50" FontFamily='Stencil' Background='Red' Foreground='White' BorderThickness='0'>
System will be rebooted in 15 minutes!
</Label>
<Label HorizontalAlignment="Center" FontSize="15" FontFamily='Consolas' Background='Red' Foreground='White' BorderThickness='0'>
Worried about losing data? Talk to your friendly help desk representative and freely share your concerns!
</Label>
</StackPanel>
</Border>
</Window>
"@
Add-Type
-assemblyName
PresentationFramework
$reader
=
[System.XML.XMLReader]
::Create(
[System.IO.StringReader]
$xaml
)
$window
=
[System.Windows.Markup.XAMLReader]
::Load(
$reader
)
$Window
.AllowsTransparency =
$True
$window
.SizeToContent =
'WidthAndHeight'
$window
.ResizeMode =
'NoResize'
$Window
.Opacity = .7
$window
.Topmost =
$true
$window
.WindowStartupLocation =
'CenterScreen'
$window
.WindowStyle =
'None'
# show message for 5 seconds:
$null
=
$window
.Show()
Start-Sleep
-Seconds
5
$window
.Close()
原文地址:Showing WPF Info Message
0 0
- Powershell演示WPF弹窗
- WPF多线程演示
- WPF多线程演示
- PowerShell结合WPF开发图形工具 1
- WPF入门(一):简单的演示
- 使用 Windows PowerShell 构建 WPF 应用程序的奥秘
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- powershell
- Powershell
- PowerShell
- Powershell
- powershell
- EasyUI DataGrid 窗口大小自适用
- uboot移植之uboot和kernel的参数传递
- [译]Apply和数组:三个技巧
- 差分约束入门题ZOJ2770&&AOJ517
- 模型
- Powershell演示WPF弹窗
- 可变参数个数的函数
- 免费镜像地址收集,让自己的下载更快一点
- JSP九个隐式对象
- 单片机与PC机串口通讯接地问题
- python ------------- __enter__(),__exit__(),with
- 鬼地方个价格更何况
- Extjs4.2 选择器 Ext.ComponentQuery.query
- 的市规划局