国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PowerShell > 正文

Powershell使用WPF技術實現彈窗提示實例

2020-05-30 20:10:44
字體:
來源:轉載
供稿:網友

WPF (Windows Presentation Foundation) 技術能讓你創建窗口和對話框。它的優勢是在窗體設計時能與代碼分開。

這里有個簡單的顯示彈出消息練習。這個消息是定義在XAML代碼中它的實現類似HTML(但是請區分大小寫)。你能輕松的調整字體大小,內容,顏色等等。不需要嵌入任何代碼。
代碼如下:
$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>
"@

$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()

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 栾川县| 乐安县| 汕尾市| 师宗县| 竹山县| 蒲城县| 来凤县| 小金县| 梁平县| 大庆市| 敖汉旗| 卓尼县| 高唐县| 离岛区| 隆回县| 会昌县| 海口市| 都兰县| 枞阳县| 上饶市| 沾化县| 兰考县| 上高县| 宿迁市| 城口县| 兰溪市| 苏尼特右旗| 云龙县| 建水县| 兴国县| 建阳市| 宁武县| 纳雍县| 沿河| 湖北省| 嘉义市| 崇信县| 西贡区| 临邑县| 米易县| 额尔古纳市|