markus2016
Goto Top

Powershell: .ani Datei anzeigen?

Hallo zusammen,

seit kurzem beschäftige ich mich mit Powershell und erstelle eine GUI zur Installation der im eigenen Windows Image integrierten Programme.
Leider hänge ich gerade an der Stelle, wenn mit "Get-Job -state Running" der Windows eigene animierte Cursor (.ani) bis zum "Get-Job -state Completed" und dem setzen des "ok.png" dargestellt werden soll.
Den Cursor bekomme ich gar nicht angezeigt.
Bin ich auf dem Holzweg oder habe ich nur was übersehen?

Weiter würde ich gerne, den Namen, von dem Programm, welches gerade installiert wird, für diese Zeit fett (style=Bold) darstellen.
Hat auch hier jemand einen Tipp, wie ich das sinnvoll umsetzen kann?

Vielen Dank für Eure Unterstützung.

bild

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")   
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")   

# Name Programme

$Name_01 = "Visual C++ 2010 x64 Redistributable"   
$Name_02 = "Visual C++ 2015 x64 Redistributable"   
$Name_03 = "Microsoft .NET Framework"  
$Name_04 = "Microsoft XML Basisdienste"   
$Name_05 = ""   
$Name_06 = ""   
$Name_07 = ""   
$Name_08 = ""   
$Name_09 = ""   
$Name_10 = ""   
$Name_11 = ""   
$Name_12 = ""   
$Name_13 = ""   
$Name_14 = ""   
$Name_15 = ""   
$Name_16 = ""   
$Name_17 = ""  
$Name_18 = ""  
$Name_19 = ""  
$Name_20 = ""  
$Name_21 = ""  
$Name_22 = ""   

# Programme

$Pfad_01 = { Start-Process "C:\Software\Microsoft\Visual C++ 2010 x64 Redistributable\VisualC++Redistributable.vbs" -Wait }  
$Pfad_02 = { Start-Process "C:\Software\Microsoft\Visual C++ 2015 x64 Redistributable\VisualC++Redistributable.vbs" -Wait }  
$Pfad_03 = { Start-Process "C:\Software\Microsoft\Microsoft .NET Framework\.NET Framework 4.6\Microsoft.NETFramework.vbs" -Wait}  
$Pfad_04 = { Start-Process "C:\Software\Microsoft\Microsoft XML Basisdienste\MicrosoftXMLBasisdienste.vbs" -Wait }  
$Pfad_05 = 
$Pfad_06 = 
$Pfad_07 = 
$Pfad_08 = 
$Pfad_09 = 
$Pfad_10 = 
$Pfad_11 =
$Pfad_12 = 
$Pfad_13 = 
$Pfad_14 = 
$Pfad_15 = 
$Pfad_16 =
$Pfad_17 = 
$Pfad_18 = 
$Pfad_19 = 
$Pfad_20 =
$Pfad_21 = 
$Pfad_22 = 

# Bilder

$Bild_01 = "$PSScriptRoot\Bilder\Bild_01.ico"  
$Bild_02 = "$PSScriptRoot\Bilder\Bild_02.png"  
$Bild_03 = "$PSScriptRoot\Bilder\Bild_03.png"  
$Bild_04 = "$PSScriptRoot\Bilder\ok.png"  
$Bild_05 = "$PSScriptRoot\Bilder\nok.png"  
$Bild_06 = "$PSScriptRoot\Bilder\busy.ani"  

# Fenster
$objForm = New-Object System.Windows.Forms.Form
$objForm.StartPosition = "CenterScreen"  
$objForm.Size = New-Object System.Drawing.Size(1000,600)
$objForm.Text = "Windows Setup"  
$objForm.BackColor = "white"  
$objForm.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon("$Bild_01")  
$objForm.Opacity = 0.9    # Durchsichtigkeit 1=100% 0.1=10
$objForm.Topmost = $true
$objForm.ShowInTaskbar=$false
$objForm.MaximizeBox = $false
$objForm.MinimizeBox = $false
$objForm.ControlBox = $true
$objForm.ShowIcon = $true
$objForm.Visible = $true

# Linie (oben)
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(0,0) 
$objLabel.Size = New-Object System.Drawing.Size(1000,20)
$objLabel.BackColor = "lightblue"  
$objForm.Controls.Add($objLabel)

# Bild (links)
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(25,40) 
$objLabel.Size = New-Object System.Drawing.Size(256,256)
$objLabel.BackColor = "white"  
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_02")  
$objForm.Controls.Add($objLabel)

# Textfeld (oben)
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(340,40) 
$objLabel.Size = New-Object System.Drawing.Size(500,30)
$objLabel.Font = "Arial Unicode MS, 14"  
$objLabel.ForeColor = "black"                                 
$objLabel.Text = "Programme werden installiert..."  
# $objLabel.Name = "Programme werden installiert..."  
$objForm.Controls.Add($objLabel)

# Bild (rechts)
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(700,260) 
$objLabel.Size = New-Object System.Drawing.Size(256,256)
$objLabel.BackColor = "white"  
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_03")  
$objForm.Controls.Add($objLabel)

# Linie (unten)
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(0,540) 
$objLabel.Size = New-Object System.Drawing.Size(1000,20)
$objLabel.BackColor = "lightblue"  
$objForm.Controls.Add($objLabel)

# Programme starten...

# Textfeld Programm 01
if (-not $Name_01) { Exit }
else
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(345,80) 
$objLabel.Size = New-Object System.Drawing.Size(240,20)
$objLabel.BackColor = "white"   
$objLabel.Font = "Arial Unicode MS, 10" #, style=Bold  
$objLabel.ForeColor = "black"  
$objLabel.Text = "$Name_01"  
# $objLabel.Name = "Name_01"  
$objForm.Controls.Add($objLabel)

$objForm.Show() 

if ($objLabel.Text = "$Name_01")  
{
$Name_01 = Start-Job $Pfad_01  
Wait-Job -Job $Name_01 
Receive-Job $Name_01

if (Get-Job -state Running)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_06")  
$objForm.Controls.Add($objLabel)

$objForm.Show()
}

if (Get-Job -state Completed)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_04")  
$objForm.Controls.Add($objLabel)
}
else
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_05")  
$objForm.Controls.Add($objLabel)

$objForm.Show()
}}}
Remove-Job $Name_01

# Textfeld Programm 02
if (-not $Name_02) { Exit }
else
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(345,100) 
$objLabel.Size = New-Object System.Drawing.Size(240,20)
$objLabel.BackColor = "white"   
$objLabel.Font = "Arial Unicode MS, 10"  
$objLabel.ForeColor = "black"  
$objLabel.Text = "$Name_02"  
# $objLabel.Name = "Name_02"  
$objForm.Controls.Add($objLabel)

$objForm.Show() 

if ($objLabel.Text = "$Name_02")  
{
$Name_02 = Start-Job $Pfad_02 
Wait-Job -Job $Name_02 
Receive-Job $Name_02

if (Get-Job -state Running)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,102) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_06")  
$objForm.Controls.Add($objLabel)

$objForm.Show()
}

if (Get-Job -state Completed)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,102) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_04")  
$objForm.Controls.Add($objLabel)
}
else
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,102) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_05")  
$objForm.Controls.Add($objLabel)

$objForm.Show()
}}}
Remove-Job $Name_02

...

Content-Key: 300309

Url: https://administrator.de/contentid/300309

Ausgedruckt am: 19.03.2024 um 11:03 Uhr

Mitglied: 114757
Lösung 114757 29.03.2016 aktualisiert um 16:27:36 Uhr
Goto Top
Cursor setzen:
$objForm.Cursor = [System.Windows.Forms.Cursors]::WaitCursor
Text eines Labels zur Laufzeit fett machen:
$objLabel.Font = new-object System.Drawing.Font($objLabel.Font,[System.Drawing.FontStyle]::Bold)
Gruß jodel32
Mitglied: 114757
Lösung 114757 29.03.2016 aktualisiert um 17:45:18 Uhr
Goto Top
Und zum laden eines ANI-Cursors kann man das so machen
Add-Type -MemberDefinition @"  
[DllImport("user32.dll")]  
public static extern IntPtr LoadCursorFromFile(String lpFileName);
"@ -Namespace "MyWin32" -Name "LoadCursor"  

$objForm.Cursor = [MyWin32.LoadCursor]::LoadCursorFromFile('C:\Windows\Cursors\aero_busy.ani')  
Mitglied: Markus2016
Markus2016 29.03.2016 um 19:19:54 Uhr
Goto Top
Hallo jodel32,

vielen Dank für die Hilfe.
Werde mich gleich mal hinsetzen und versuchen das in mein Script einzuarbeiten.
Bin mal gespannt, ob ich das hinbekomme. face-smile

Vielen Dank

Gruß

Markus2016
Mitglied: Markus2016
Markus2016 30.03.2016 um 00:59:44 Uhr
Goto Top
Hallo jodel32,

das ändern der Schrift habe ich hinbekommen. Vielen Dank. face-smile

Den Cursor bekomme ich einfach nicht zum Laufen. face-sad
Da bräuchte ich noch etwas Hilfe bzw. einen Tipp.

Es ist mir auch aufgefallen, dass der "if (Get-Job -state Running)" in meinem Script überhaupt nicht funktioniert.
Deswegen habe ich den Cursor auch unter "else" im Script ausprobiert.
Ich finde gerade keine Lösung und komme ich nicht weiter...

Bin für jede weitere Unterstützung sehr dankbar. face-wink

if (-not $Name_01) { Exit }
else
{
$objLabel_01 = New-Object System.Windows.Forms.Label
$objLabel_01.Location = New-Object System.Drawing.Size(345,80) 
$objLabel_01.Size = New-Object System.Drawing.Size(240,20)
$objLabel_01.BackColor = "white"   
$objLabel_01.Font = "Arial Unicode MS, 10"  
$objLabel_01.ForeColor = "black"  
$objLabel_01.Text = "$Name_01"  
$objForm.Controls.Add($objLabel_01)

$objForm.Show() 

if ($objLabel.Text = "$Name_01")  
{
$Name_01 = Start-Job $Pfad_01
Get-Job -Name Job1
Wait-Job -Job $Name_01
Receive-Job $Name_01

if (Get-Job -state Running)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_07")  
$objForm.Controls.Add($objLabel)
$objLabel_01.Font = new-object System.Drawing.Font($objLabel_01.Font,[System.Drawing.FontStyle]::Bold)
$objForm.Controls.Add($objLabel_01)

$objForm.Show() 
}

if (Get-Job -state Completed)
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_04")  
$objForm.Controls.Add($objLabel)
$objLabel_01.Font = new-object System.Drawing.Font($objLabel_01.Font = "Arial Unicode MS, 10")  
$objForm.Controls.Add($objLabel_01)
}
else
{
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(585,82) 
$objLabel.Size = New-Object System.Drawing.Size(16,16)
$objLabel.Cursor = [MyWin32.LoadCursor]::LoadCursorFromFile('$Bild_06')# $objLabel.Image = [System.Drawing.Image]::FromFile("$Bild_05")  
$objForm.Controls.Add($objLabel)
$objLabel_01.Font = new-object System.Drawing.Font($objLabel_01.Font,[System.Drawing.FontStyle]::Italic)
$objForm.Controls.Add($objLabel_01)

$objForm.Show() 
}}}
Remove-Job $Name_01

In der Konsole wird folgender Fehler angezeigt:
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                  
--     ----            -------------   -----         -----------     --------             -------                  
1      Job1            BackgroundJob   Running       True            localhost             Start-Process "C:\Sof...  
1      Job1            BackgroundJob   Failed        False           localhost             Start-Process "C:\Sof...  
powershell : Dieser Befehl kann aufgrund des folgenden Fehlers nicht ausgefhrt werden: Das System kann die angegebene Datei nicht 
In Zeile:1 Zeichen:1
+ powershell -ep RemoteSigned -file "D:\123\Powershell\Windows Setup.ps ...  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Dieser Befehl k...ne Datei nicht :String) , RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
finden.
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    + PSComputerName        : localhost
 
Ausnahme beim Festlegen von "Cursor": "Der Wert "0" kann nicht in den Typ "System.Windows.Forms.Cursor" konvertiert   
werden. Fehler: "Der an Cursor bergebene Win32-Handle ist ungltig oder hat den falschen Typ.""  
In D:\123\Powershell\Windows Setup.ps1:176 Zeichen:1
+ $objLabel.Cursor = [MyWin32.LoadCursor]::LoadCursorFromFile('$Bild_06 ...  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) , SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

Vielen Dank schon mal im Voraus für die Unterstützung.

Gruß

Markus2016
Mitglied: 114757
114757 30.03.2016 aktualisiert um 10:40:01 Uhr
Goto Top
$objLabel.Cursor = [MyWin32.LoadCursor]::LoadCursorFromFile('$Bild_06')

Kein Wunder, du verwendest fälschlicherweise eine Variable zwischen einfachen Hochkommas! Das kann nicht funktionieren, da Variablen nur zwischen normalen Anführungszeichen expandiert werden.
Außerdem brauchst du hier sowieso keinerlei Anführungszeichen!!

Außerdem ist das definieren von jeweils einer Variablen für jede Software sehr schlechtes Coding.
Das macht man mit einem Array und iteriert dann mit einer For-Each-Schleife über dieses Array.
Da das ja sowieso Installationen sind und davon immer nur eine Laufen sollte ist das ja kein Problem.

Damit deine UI aber responsive bleibt solltest du dich mal mit Powershell-Multithreading auseinander setzen.

Dazu gibt es hier im Forum diverse Beiträge, einfach mal die Suche anwerfen. Wir müssen ja nicht jedes mal das Rad neu erfinden!

Gruß jodel32
Mitglied: Markus2016
Markus2016 01.04.2016 aktualisiert um 13:38:46 Uhr
Goto Top
Hallo jodel32,

danke für die Hinweise.

Werde mir das mit der For-Schleife und dem Multithreading mal anschauen.

Das Script funktioniert jetzt eigentlich wie es soll. face-smile
Sobald der Job in den Status "Running" geht wird das Bild und der Style der Schrift geändert.
Nur das mit dem Cursor funktioniert auch ohne den Hochkommas nicht. face-sad
Ich verwende jetzt erstmal ein Bild bis ich hierzu eine Lösung gefunden habe.

Gruß

Markus2016
Mitglied: 114757
114757 01.04.2016 aktualisiert um 13:44:36 Uhr
Goto Top
Zitat von @Markus2016:
Nur das mit dem Cursor funktioniert auch ohne den Hochkommas nicht. face-sad
Tja, weil du laut deinem geposteteten Code den benötigten C-Sharp-Code nicht geladen hast face-wink

Geht hier einwandfrei, guckst du dieses Beispiel:
Add-Type -MemberDefinition @"  
[DllImport("user32.dll")]  
public static extern IntPtr LoadCursorFromFile(String lpFileName);
"@ -Namespace "MyWin32" -Name "LoadCursor"  

function GenerateForm {

[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null  
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null  

#region Generated Form Objects
$form1 = New-Object System.Windows.Forms.Form
$btn = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects

$handler_button1_Click= 
{
    $form1.Cursor = [MyWin32.LoadCursor]::LoadCursorFromFile('C:\Windows\Cursors\aero_busy.ani')  
}

$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
	$form1.WindowState = $InitialFormWindowState
}

#----------------------------------------------
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 95
$System_Drawing_Size.Width = 180
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = "form1"  
$form1.Text = "Cursor"  


$btn.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 12
$btn.Location = $System_Drawing_Point
$btn.Name = "btn"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 71
$System_Drawing_Size.Width = 156
$btn.Size = $System_Drawing_Size
$btn.TabIndex = 0
$btn.Text = "Maus-Cursor animieren"  
$btn.UseVisualStyleBackColor = $True
$btn.add_Click($handler_button1_Click)

$form1.Controls.Add($btn)

#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$form1.ShowDialog()| Out-Null

} #End Function

GenerateForm
Mitglied: Markus2016
Markus2016 01.04.2016 um 19:04:00 Uhr
Goto Top
Hallo jodel32,

oh je, entschuldige bitte. Das Laden des Cursor mit deinem Code funktioniert natürlich einwandfrei.

Was ich nicht hinbekomme, ist den Cursor im Status Running wie ein *.png hinter dem Namen des jeweiligen Programms laufen zu lassen.
So wie ich es auf dem Bild mit der Sanduhr mache.
Danke für dein Script und die Hilfe.
Und entschuldige bitte nochmal, dass ich nicht genau geschrieben habe, was funktioniert und was nicht.

unbenannt

if (-not $Name_01) { Exit }
else
{
$objLabel_01 = New-Object System.Windows.Forms.Label
$objLabel_01.Location = New-Object System.Drawing.Size(345,80) 
$objLabel_01.Size = New-Object System.Drawing.Size(240,20)
$objLabel_01.BackColor = "white"   
$objLabel_01.Font = "Arial Unicode MS, 10"  
$objLabel_01.ForeColor = "black"  
$objLabel_01.Text = "$Name_01"  
$objForm.Controls.Add($objLabel_01)

$objForm.Show() 

if ($objLabel_01.Text = "$Name_01")  
{
$Name_01 = Start-Job $Pfad_01
Get-Job

if (Get-Job -state Running)
{
$objImage_04 = New-Object System.Windows.Forms.Label
$objImage_04.Location = New-Object System.Drawing.Size(585,82) 
$objImage_04.Size = New-Object System.Drawing.Size(16,16)
$objImage_04.Image = [System.Drawing.Image]::FromFile("$Bild_04")  
$objForm.Controls.Add($objImage_04)

$objLabel_01.Font = New-Object System.Drawing.Font($objLabel_01.Font,[System.Drawing.FontStyle]::Bold)
$objForm.Controls.Add($objLabel_01)

Wait-Job -Job $Name_01
Receive-Job -Job $Name_01

$objForm.Show() 
}

if (Get-Job -state Completed)
{
$objImage_05 = New-Object System.Windows.Forms.Label
$objImage_05.Location = New-Object System.Drawing.Size(585,82) 
$objImage_05.Size = New-Object System.Drawing.Size(16,16)
$objImage_05.Image = [System.Drawing.Image]::FromFile("$Bild_05")  
$objForm.Controls.Remove($objImage_04)
$objForm.Controls.Add($objImage_05)

$objLabel_01.Font = New-Object System.Drawing.Font($objLabel_01.Font,[System.Drawing.FontStyle]::Regular)
$objForm.Controls.Add($objLabel_01)
}
else
{
$objImage_06 = New-Object System.Windows.Forms.Label
$objImage_06.Location = New-Object System.Drawing.Size(585,82) 
$objImage_06.Size = New-Object System.Drawing.Size(16,16)
$objImage_06.Image = [System.Drawing.Image]::FromFile("$Bild_06")  
$objForm.Controls.Remove($objImage_04)
$objForm.Controls.Add($objImage_06)

$objLabel_01.Font = New-Object System.Drawing.Font($objLabel_01.Font,[System.Drawing.FontStyle]::Regular)
$objForm.Controls.Add($objLabel_01)

$objForm.Show() 
}}}
Remove-Job -Job $Name_01

Gruß
Markus2016
Mitglied: 114757
Lösung 114757 01.04.2016 aktualisiert um 21:09:57 Uhr
Goto Top
Ach so, na dann nehm doch einfach ein GIF das du in einer PictureBox platzierst, das ANI kannst du ja von mir aus in ein GIF umwandeln.
function GenerateForm {

#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null  
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null  
#endregion

$form1 = New-Object System.Windows.Forms.Form
$pictureBox1 = New-Object System.Windows.Forms.PictureBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState

$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 272
$System_Drawing_Size.Width = 292
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = "form1"  
$form1.Text = "Animated Gif"  

$pictureBox1.Anchor = 15
$pictureBox1.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 12
$pictureBox1.Location = $System_Drawing_Point
$pictureBox1.Name = "pictureBox1"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 248
$System_Drawing_Size.Width = 268
$pictureBox1.Size = $System_Drawing_Size
$pictureBox1.SizeMode = 4
$pictureBox1.TabIndex = 0
$pictureBox1.TabStop = $False
$pictureBox1.ImageLocation = 'http://www.kizoa.com/img/e8nZC.gif'  
$form1.Controls.Add($pictureBox1)

#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$form1.ShowDialog()| Out-Null

} #End Function
GenerateForm

Happy Weekend
Gruß jodel
Mitglied: Markus2016
Markus2016 01.04.2016 um 22:48:03 Uhr
Goto Top
Hallo jodel,

das ich da nicht selber drauf gekommen bin?
1000 Dank funktioniert perfekt.

Schönes Wochenende face-smile

Gruß

Markus