您现在的位置是:网站首页> 编程资料编程资料
Powershell使用WPF技术实现弹窗提示实例_PowerShell_
2023-05-26
434人已围观
简介 Powershell使用WPF技术实现弹窗提示实例_PowerShell_
WPF (Windows Presentation Foundation) 技术能让你创建窗口和对话框。它的优势是在窗体设计时能与代码分开。
这里有个简单的显示弹出消息练习。这个消息是定义在XAML代码中它的实现类似HTML(但是请区分大小写)。你能轻松的调整字体大小,内容,颜色等等。不需要嵌入任何代码。
复制代码 代码如下:
$xaml = @"
"@
$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()
您可能感兴趣的文章:
相关内容
- PowerShell注册表操作命令总结_PowerShell_
- Powershell中调用邮件客户端发送邮件的例子_PowerShell_
- Powershell从注册表中查询默认MAPI客户端的例子_PowerShell_
- PowerShell远程安装MSI安装包、EXE可执行程序的方法_PowerShell_
- 类似rpm包管理器的Windows Installer PowerShell Module简介_PowerShell_
- PowerShell脚本源码输出到文件的最佳写法_PowerShell_
- PowerShell批量安装msi后辍软件的方法_PowerShell_
- PowerShell捕获错误的2种方法(异常捕获命令、错误变量)_PowerShell_
- 自定义PowerShell控制台提示符风格的方法_PowerShell_
- PowerShell比较文本文件的两个方法_PowerShell_
