James Brundage posted a quick Christmas tree written in WPK (the WPF PowerShell Kit). Check out his code.
this script has tons of Christmas goodies
Adding Ornaments
Using the WPF Ellipse and bitmap effect gives the following. I need to investigate how to get the resized behavior to work again.
Import-Module WPK Function Add-Ornaments ($x, $y, $stop, $step) { $ellipseSize = 10 $e = @() Function Get-RandomColor { function ql {$args} ql darkgreen blue red coral | Get-Random } For($left = $x; $left -lt $stop; $left+=$step) { $e += New-Ellipse -Height $ellipseSize -Width $ellipseSize ` -Fill (Get-RandomColor) ` -Left $left ` -Top $y ` -BitmapEffect { New-BevelBitmapEffect -BevelWidth 1} } $e } New-Window -WindowStartupLocation centerscreen -Width 190 -Height 210 -show { New-Canvas { New-Polygon -Name Tree -Points { # Start from the top "87,0" # Left Side of Tree "0,150" "75,140" # Bottom of Tree "75,175" "95,175" # Right Side of Tree "95,140" "175,150" # Back to the top "87,0" } -On_SizeChanged { if ($_.PreviousSize.Width -eq 0 -and $_.PreviousSize.Height -eq 0) { $this.Resources.OriginalSize = $_.NewSize } else { $originalSize = $this.Resources.OriginalSize $ScaleX = $_.NewSize.Width /$originalSize.Width $ScaleY = $_.NewSize.Height / $originalSize.Height $this.RenderTransform = New-ScaleTransform -ScaleX $ScaleX -ScaleY $ScaleY } } -BitmapEffect { New-BevelBitmapEffect -BevelWidth 1 } -Fill darkgreen Add-Ornaments 81.8 0 92 20 Add-Ornaments 71.8 20 92 20 Add-Ornaments 61.8 40 102 20 Add-Ornaments 51.8 60 112 20 Add-Ornaments 41.8 80 122 20 Add-Ornaments 31.8 100 132 20 Add-Ornaments 21.8 120 142 20 } } | Out-Null
{ 0 comments… add one now }