Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
- [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
- $handler_GetButton_Click=
- {
- $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
- InitialDirectory = [Environment]::GetFolderPath('Desktop')
- #Filter = 'Documents (*.docx)|*.docx|SpreadSheet (*.xlsx)|*.xlsx'
- }
- $null = $FileBrowser.ShowDialog()
- [System.Windows.Forms.MessageBox]::Show($FileBrowser.FileName, "Bitlocker key :", "OK")
- }
- $testGUI = New-Object System.Windows.Forms.Form
- $testGUI.Text = "GUITest"
- $testGUI.Name = "GT"
- $testGUI.DataBindings.DefaultDataSourceUpdateMode = 0
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 330
- $System_Drawing_Size.Height = 252
- $testGUI.ClientSize = $System_Drawing_Size
- $iconBase64 = 'AAABAAEAMDAAAAEAIACBBgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAwAAAAMAgGAAAAVwL5hwAABkhJREFUaIHtWHtME3cc//zu2mspbQFRfE1Fo6DZhGnUMZSpY4mTMJzZZA8zYpw6F7NodBMZowbxvUlmFudzik73wC0qIpvJnIpBjRINasQHZg1MrWIZ0FKuj7vf/sCitgdc4aos2eePpvk+P5/73e91BApgwY2zTFTy3B6ilhupqre/xbhciSwlI5ocTVoACNWF8gKhlSLHnfaE639leNfl+8e2122KSRC72pt0NjE3bjyWXypD1pikoTqzZQFjc0xj3O7BRHzEiTwsT0FbbZRhIKrVf4kG3SFHdN9Na8pLq/LixyOnouzpCEhPT8fYknP4zG5G7vMvz+dumtcQtxAOSjtOfqIzgahm64WY6KycK2e2fKmPxvmUcSgsLAysTCDBJ06cwKRJk/Dh8ix2wI5D2zS3780mYAJq6AsKEc7+vXfWzJk277vcNYK3h1wEJGA+gIQDv7DVc5bt4awN7wfItV24IsN+GLhjbcbZ6W8LWwLIY+UGm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ULpoZtaT2umFJ7XVD3ZIPotwG3RFKlJ9XCo8Ahat3j5+XW66/iw35mI6WF2jD+q9qAaTm9on9SWOxvtOFL5p+UHQERI3GCY7LBIBPp6ThAICDD/8DADguU9RonEr2VFQAq2Jv6QjbCABfHS1qtXv/6wjbyKrYW0r2VFSAIFJts8OBnMkpfr6cySlodjggiFSrZE9FBRCXawjtGTE473gJCgoKWu0FBQXIO14C2jNiMHG5hijZU1kBggBSYykCgFmzZrXavf9JjaWICIJUaqeh8DJKwNnt/Q9TGuHrOUxpBGe391dyBQKCshMTMIDfrtViU34f+M9fKf8X8KwRFAFSRYP1pIJS98zuHUY5NiUQlOM0t3B18cYxyZv1Wi0BADvPU9vC1R8Ho1cQBBCoGmxxzeUVmx2tFm+jbn+c9oI89htcSM4BFcOS7nQvpmjhJOWTFGCM6mXpXld7CmNUr7tSHkkBV8fF7PJoOJ50AxEEFB4Nx1cmxO6S8vsJWBqfiN179zbYIo0TXGEGczDusXJBCYErzGC2RRonFOz5vjEzPtEv5l8G7kH5AsusdAAAAABJRU5ErkJggg=='
- $iconBytes = [Convert]::FromBase64String($iconBase64)
- $stream = New-Object IO.MemoryStream($iconBytes, 0, $iconBytes.Length)
- $stream.Write($iconBytes, 0, $iconBytes.Length);
- $iconImage = [System.Drawing.Image]::FromStream($stream, $true)
- $testGUI.Icon = [System.Drawing.Icon]::FromHandle((New-Object System.Drawing.Bitmap -Argument $stream).GetHIcon())
- $getButton = New-Object System.Windows.Forms.Button
- $getButton.TabIndex = 0
- $getButton.Name = "button"
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 310
- $System_Drawing_Size.Height = 232
- $getButton.Size = $System_Drawing_Size
- $getButton.UseVisualStyleBackColor = $True
- #$getButton.Text = "OK"
- $System_Drawing_Point = New-Object System.Drawing.Point
- $System_Drawing_Point.X = 10
- $System_Drawing_Point.Y = 10
- $getButton.Location = $System_Drawing_Point
- $getButton.DataBindings.DefaultDataSourceUpdateMode = 0
- $getButton.add_Click($handler_GetButton_Click)
- $image = [System.Drawing.Image]::FromFile("D:\Pictures\misc\Magnifying_Glass_Photo.jpg")
- $getButton.Image = $image
- $testGUI.Controls.Add($getButton)
- $testGUI.ShowDialog()| Out-Null
Add Comment
Please, Sign In to add comment