PowerShell using WPF technology to implement a window tip example _powershell

Source: Internet
Author: User

WPF (Windows presentation Foundation) technology allows you to create windows and dialog boxes. Its advantage is that it can be separated from the code when designing a form.

Here's a simple display pop-up message exercise. This message is defined in XAML code as its implementation is similar to HTML (but please be case-sensitive). You can easily adjust the font size, content, color, and so on. You do not need to embed any code.

Copy Code code as follows:

$xaml = @ "
<window
xmlns= ' http://schemas.microsoft.com/winfx/2006/xaml/presentation ' >

<border borderthickness= "borderbrush=" Yellow "cornerradius=" 9 "background= ' Red ' >
<StackPanel>
<label fontsize= "fontfamily= ' stencil ' background= ' Red ' foreground= ' white ' borderthickness= ' 0 ' >
System'll is rebooted in minutes!
</Label>

<label horizontalalignment= "Center" fontsize= "fontfamily= ' Consolas ' background= ' Red ' foreground= ' white ' borderthickness= ' 0 ' >
Worried about losing data? Talk to your friendly Help desk representative and freely share your
</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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.