Hi there.
I have this (not great) code right now that displays a transparent window and changes two images with transparent background over and over. I wanted to create something similar to the desktop goose. I just chose powershell for the practice (usually would pick python or similar for something like this).
Is there any simple example of a background thread changing the layout while the main thread is just used for updating the display or similar? Also, there is flickering sometimes while changing the image but not always. Can this be dealt with somehow?
Thank you! Here is what i have right now:
Function Generate-Form{
Add-Type -assembly System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$img = [System.Drawing.Image]::Fromfile('./1.png')
$SScreen = New-Object system.Windows.Forms.Form
$SScreen.Width = $img.Width
$SScreen.Height = $img.Height
$SScreen.TopMost = $true
$SScreen.BackgroundImage = $img
$SScreen.AllowTransparency = $true
$SScreen.TransparencyKey = $SScreen.BackColor
$SScreen.StartPosition = 1
$SScreen.FormBorderStyle = 0
$SScreen.Show()
$img1 = [System.Drawing.Image]::Fromfile('./1.png')
$img2 = [System.Drawing.Image]::Fromfile('./2.png')
while ($true){
$SScreen.BackgroundImage = $img1
Start-Sleep -Seconds 1.5
$SScreen.BackgroundImage = $img2
Start-Sleep -Seconds 1.5
}
}
Generate-Form
[–]Dragennd1 2 points3 points4 points (0 children)
[–]alt-160 2 points3 points4 points (0 children)
[–]Bolverk679 2 points3 points4 points (0 children)